c# defining struct code example

Example 1: how to make custom struct C#

struct Parts
    {
        public static Parts NewPart(string PartName, string strName, int PartId)
        {
            return new Parts
            {
                Part = PartName,
                Name = strName,
                Id = PartId
            };
        }
        public string Part { get; set; }
        public string Name { get; set; }
        public string Id { get; set; }
    }

Example 2: structure in c sharp with example

struct Books {
   public string title;
   public string author;
   public string subject;
   public int book_id;
};