Add new item to List object C#

后端 未结 4 1413
灰色年华
灰色年华 2021-01-16 09:33

I want to add new object to a list: My code:

List abc = new List();
abc.Add(new geo_tag() { latitude = 111, longitude = 122, un         


        
4条回答
  •  温柔的废话
    2021-01-16 10:10

    Something like this for example?

           List abc = new List {};
            abc.Add(new geo_tag(11, 112, "SSS"));
    
    
      public class geo_tag
    {
        public int latitude { get; set; }
        public int longitude { get; set; }
        public string unit { get; set; }
    
        public geo_tag()
        {
        }
        public geo_tag(int latitude, int longitude, string unit)
        {
            this.latitude = latitude;
            this.longitude = longitude;
            this.unit = unit;
        }
    }
    

提交回复
热议问题