1

what does this mean in c# ?

public Extra_Bed_Configurations[][] extra_bed_configurations { get; set; }

Where Extra_Bed_Configurations Class have below properties.

public class Extra_Bed_Configurations
{
    public string type { get; set; }
    public int code { get; set; }
    public int count { get; set; }
    public string name { get; set; }
}
Rahul Hendawe
  • 902
  • 1
  • 14
  • 39
  • 2
    Delcaring a [Jagged array](https://msdn.microsoft.com/en-us/library/2s05feca.aspx) property of that class type. – Shyju Oct 12 '16 at 13:18
  • This mean that you have 2 dimension array of class Extra_Bed_Configurations – Ridikk12 Oct 12 '16 at 13:18
  • Possible duplicate of [What is a jagged array?](http://stackoverflow.com/questions/2576759/what-is-a-jagged-array) – Igor Oct 12 '16 at 13:20
  • 1
    Which part of it don't you understand? – T.J. Crowder Oct 12 '16 at 13:20
  • to be the most direct: the `{ get; set;}` part is not relevant for you. The `Extra_Bed_Configurations[][]` means, that this field is an Array of objects of type `Extra_Bed_Configurations[]`, which is just an Array of `Extra_Bed_Configurations`. (Also use google and the MSDN documentation for this stuff in the future) – TheHowlingHoaschd Oct 12 '16 at 13:27

4 Answers4

4

That's a public property of type jagged array (array of arrays) Extra_Bed_Configurations

Note:

multidimenstional: Extra_Bed_Configurations[,] extra_bed_configurations

jagged: Extra_Bed_Configurations[][] extra_bed_configurations


sample declaration of a 2x2

extra_bed_configurations = new Extra_Bed_Configurations[][]{ 
        new Extra_Bed_Configurations[] {
            new Extra_Bed_Configurations() { type = "foo"}, 
            new Extra_Bed_Configurations() { type = "foo"}
        },
        new Extra_Bed_Configurations[] { 
            new Extra_Bed_Configurations() { type = "foo"}, 
            new Extra_Bed_Configurations() { type = "foo"}}
    };
fubo
  • 44,811
  • 17
  • 103
  • 137
2
  • public is access modifier, which doesn't restrict any access to property;

  • Extra_Bed_Configurations[][] is jagged array;

  • extra_bed_configurations is name of your property respectively;

  • { get; set; } means that this property is auto-implemented.

Yurii N.
  • 5,455
  • 12
  • 42
  • 66
1

[][] is array of array.

1 -> A B C D
2 -> E F G H I J
3 -> K L M 
4 -> N O 
Christopher G. Lewis
  • 4,777
  • 1
  • 27
  • 46
0

{get;set} after a member creates getters and setters for those types. Here's the duplicate c#: getter/setter

Community
  • 1
  • 1
UKMonkey
  • 6,941
  • 3
  • 21
  • 30