如果我有一個包含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 –