Thursday, November 21, 2019

C# - List.AddRange() - how copy one List object to another in one row

I have two List:
List<ObjectCoordinateBase> AllObjects;

List<InfoStar> Rows;
When I want copy objects from InfoStar class to ObjectCoordinate class, I can use List.AddRange() method.
Node: Import is class, that contains Rows.
Map.AllObjects.AddRange( import.GetAsObjectCoordinateBase() );
And here:
public IEnumerable<ObjectCoordinateBase> GetAsObjectCoordinateBase() {
  List<ObjectCoordinateBase> list = new List<ObjectCoordinateBase>();

  this.Rows.ForEach( item => { 
    list.Add( new ObjectCoordinateBase( item ) );
  } );
  return list;

1 comment:

  1. Hello Josef,

    Nice blog! I am editor at Java Code Geeks ( We have the JCG program (see, that I think you’d be perfect for.

    If you’re interested, send me an email to and we can discuss further.

    Best regards,
    Eleftheria Drosopoulou