如果我有一个包含10个属性的对象列表,并且我想返回这些对象的列表,但只有10个可用的3个属性,将如何我这样做?仅返回对象的几个属性
public class Example
{
public int attr1 {get;set;}
public int attr2 {get;set;}
public int attr3 {get;set;}
public int attr4 {get;set;}
public int attr5 {get;set;}
}
return ExampleList; //have the return value be a list with only attr1, 2, and 3 visible.
http://msdn.microsoft.com/en-us/library/vstudio/bb397696.aspx –