How to create a property for a List

前端 未结 6 611
春和景丽
春和景丽 2020-12-13 00:32
private List newList;

public List NewList
{
get{return newList;}
set{newList = value;}
}

I want to create something like this, b

6条回答
  •  萌比男神i
    2020-12-13 01:29

    Simple and effective alternative:

    public class ClassName
    {
        public List MyProperty { get; set; }
    }
    

    or

    public class ClassName
    {
        public List MyProperty { get; set; }
    }
    
    
    

    For differences see this post: List vs List

    提交回复
    热议问题