如果我有一个包含 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.