Junior — Middle
Can you explain what a Data Transfer Object (DTO) is?
sobes.tech AI
Answer from AI
Data Transfer Object (DTO) — is a simple object used for transferring data between application layers or systems.
The main goal of DTO is to transfer data without business logic, often to optimize data transfer and reduce the number of calls.
Example of DTO in C#:
public class UserDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
Such an object can be used, for example, to transfer user data from a service to a controller or client application.