Friday, May 9, 2014

Set a contract of sorts for how big an array will be in C#.

WeddingGift[] forSally = new WeddingGift[4];

 
 

If you make an array as seen above and then later on in code make an assignment to it, you will have to hand in specifically four items like so:

forSally = new WeddingGift[4]
{
   somethingOld,
   somethingNew,
   somethingBorrowed,
   somethingBlue
}

No comments:

Post a Comment