Tuesday 15 January 2013

Writing an array C# -


Can anyone tell me how to create the following program as a multi-dimensional array in C #.

I think I started with something Like:

  string [,] myBeaconArray = new string [numberOfBeacons, 1];  

But how do I create each entry? The numbers in single quote (1, 3g, 3g etc.) and numbers (i.e. 136, 1037 etc.) are also hostile I have assumed that something like this will be

  myBeaconArray [positionNumber, "beacon: '" + 1 variable 1 +', interaction: "+ variable2] ;  

But this is clearly not correct. This is my first look in multi-dimensional arrays.

This is not a multi-dimensional array, at least not your example try this:

  public square root objects {public string beacons {get; set;} {Intake public int interaction; Set; }}  

To create a list, use it:

  list & lt; Root object & gt; MyBeaconArray = New List & amp; Lt; RootObject & gt; () {New root object {beacon = "1", interaction = 136}, new root object {beacon = "3G", interaction = 1037}};  

To create a fixed length array, use it:

  var myBeaconArray = new root object [] {new root object {beacon = "1" ", Interaction = 136}, new root object {beacon =" 3G ", interaction = 1037}};  

If you do not need to pass the object around, then you can use the unknown object like this:

  var myBeaconArray = New [] {new {beacon = "1", interaction = 136}, new {beacon = "3G", interaction = 1037}};  

No comments:

Post a Comment