首页 > 解决方案 > 快速操作:字段类生成器

问题描述

是否有一个工具visual studio c#可以生成类的字段?假设我们有一个class名字Contact

public class Contact
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public DateTime? CreatedAt { get; set; }
        public string CreatedBy { get; set; }
        public DateTime? UpdatedAt { get; set; }
        public string UpdatedBy { get; set; }
        public bool? Active { get; set; }
        // ....Some more Fields below
    }

当我键入Contactthen 时,就像我键入道具时一样,并将在下面生成此字段

Contact o = new Contact // Generated
{
    Id = o1.Id,
    Name = o1.Name
    // Some more fields generated here
};

注意:prop这里只是一个例子。

标签: c#visual-studio

解决方案


推荐阅读