madaxe2020
Well-known member
- Joined
- Sep 7, 2020
- Messages
- 50
- Programming Experience
- 5-10
The code runs but i dont know how to get a specified type
I want to get a IEnumerable<IEnumerable<ConnectionModel>> something with a defined type, but im struggling on casting to this data type
can somebody help?
Thanks
Madaxe
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
		
			
		
		
	
				
			I want to get a IEnumerable<IEnumerable<ConnectionModel>> something with a defined type, but im struggling on casting to this data type
can somebody help?
Thanks
Madaxe
			
				Linq Groupby:
			
		
		
		var Someobject = AllConnectionModels.OrderBy(x => x.Nomenclature)
                   .GroupBy(x => x.Nomenclature)
                   .Select(g => new
                   {
                       Connections = g.Select(
                           connection => new ConnectionModel(
                               connection.Nomenclature,
                               connection.Offset,
                           connection.AsDesigned_Layer)
                       )
                   }).ToList();
			
				ConnectionModel:
			
		
		
		public class ConnectionModel
    {
        public string Nomenclature { get; set; }
        public double Offset { get; set; }
        public double Cummulativeoffset { get; set; }
        public int AsDesigned_Layer { get; set; }
        public Object NewScrewStartObject { get; set; } = null;
        public Object NewScrewEndObject { get; set; } = null;
        public Object NewArrowObject { get; set; } = null;
        public ConnectionModel() { }
        public ConnectionModel(string Nomenclature, double Offset, int AsDesigned_Layer)
        {
            this.Nomenclature = Nomenclature;
            this.Offset = Offset;
            this.AsDesigned_Layer = AsDesigned_Layer;
        } 
	 
 
		 
 
		 
 
		