Friday, March 5, 2021

C# - How to initialize List items in new statement

One possibility:
image.Normalize( new List() { new Rectangle( 100, 100, 300, 100 ) }  );
Another possibility with setting accessible properties by name:
image.Normalize( new List()
{ 
  new Rectangle() { X=100, Y=100, Width=300, Height=100 }, 
  new Rectangle() { X=200, Y=250, Width=200, Height=50 }
}  
);

No comments:

Post a Comment