C# 将方法的返回公开到属性中

C# 将方法的返回公开到属性中,c#,mv,C#,Mv,如何在类属性中公开方法的返回 public class BIContactLib: ContactLib { //Expose it here.. to replace the code below public IEnumerable<BIContactLib> GetContactLibs { get { return (BIContactLib) GetAll} set { ; } } } public cl

如何在类属性中公开方法的返回

public class BIContactLib: ContactLib
{

   //Expose it here.. to replace the code below

    public IEnumerable<BIContactLib> GetContactLibs 
    {
        get { return (BIContactLib) GetAll}
        set { ; }
    }
}

public class BIContactLibService : IBIRequirement, IDisposable
{
    private ClientContext context = new ClientContext();

  //The return of the method here is the one I would like to expose

    public IEnumerable<BIContactLib> GetAll()
    {
        var contactslib = context.ContactLibs;
        return contactslib.ToList();
    }
}
公共类BIContactLib:ContactLib
{
//在此处公开..以替换下面的代码
公共IEnumerable GetContactLibs
{
获取{return(BIContactLib)GetAll}
集合{;}
}
}
公共类BIContactLibService:IBIRequirement,IDisposable
{
private ClientContext=new ClientContext();
//这里返回的方法就是我想公开的方法
公共IEnumerable GetAll()
{
var contactslib=context.ContactLibs;
返回联系人lib.ToList();
}
}
这背后的原因是,我想创建一个具有联系人列表库的视图模型。。。顺便说一下,这是我的视图模型

public class PersonInformation
{
    public BIPerson Person { get; set; }
    public BIAddress Address { get; set; }

    //This is where i want to use it

    public IEnumerable<BIContactLib> GetAll { get; set; }
}
公共类人物信息
{
公共双个人{get;set;}
公共双地址地址{get;set;}
//这就是我想用它的地方
公共IEnumerable GetAll{get;set;}
}
或者有其他的方法吗


最好的问候,

像这样的怎么样

public IEnumerable<BIContactLib> GetContactLibs 
    {
        get { 
             BiContractLib lib = new BiContractLib();
             return lib.GetAll();
            }        
    }
public IEnumerable GetContactLibs
{
获取{
BiContractLib=新的BiContractLib();
返回lib.GetAll();
}        
}