Is a "data transfer type" the same as a "data transfer object"?
In开发者_JAVA百科 reading about C#, I have come across the terms "data transfer type" and "data transfer object". This shows up around annonymous types, where a type is created on the fly to hold results, such as from LINQ. Are these two terms referring to the same thing ?
Thanks,
Scott
I think some more context would help here.
An anonymous type has method scope. So this means, it cannot be passed outside of it's method. Whereas a Data Transfer Object entire purpose in life is to be passed outside of it's method.
I suspect their creating Data Transfer Types through an anonymous type and then projecting this to a Data Transfer Object.
But yeah, including the sentence you found this term in would help.
The type is the description of the object, it's class and it's methods/properties/variables/...
while the object is an instance of the type.
For example:
// this describes the type Foo
public sealed class Foo
{
public int ID { get; set; }
/* ... */
}
// this is an object (instance) of foo
var fooInstance = new Foo() { ID = 4, };
精彩评论