Yeah, that whole curly bracket thing confused the heck out of me at first too. It is related to arrays. First lets look at some simple array examples:
' An array of strings
Dim names As String()
' An array of integers
Dim ages As Integer()
'An array of FieldPropertyDescriptors
Dim descriptors As FieldPropertyDescriptor()
You probably already figured out this is how you dim an array. Of course, then you have to Redim it to the correct size and then add each item, which is a pain lots of times:
' Dim an array of names
Dim names As String()
'...later in code, size and fill the array
Redim names As String(2)
names(0) = "Joe"
names(1) = "John"
As you likely know, with other types of variables, you can just set the value or initialize the variable when you dim it. But how do you do that with an array? Arrays need to be sized before adding elements to them and the elements are added by index. That is were the curly brackets come into play. The curly brackets are array initializers and allow you set the initial values of the array:
' An array of strings
Dim names As New String() {"Joe","Bob","Sam"}
' An array of integers
Dim ages As Integer() {23, 34, 56}
'An array of
Dim descriptors As FieldPropertyDescriptor() { _
New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _
"Product", GetType(boPUNAllocatedToFleshBatch)), _
New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _
"BinCode", GetType(boPUNAllocatedToFleshBatch))}
So, the curly brackets simply allow you to initialize the array with values when you create the array. Note that you do
NOT set the size of the array when you use an initializer (the curly brackets). You can also use initializers with multi dimension arrays. In that case, you need to set the rank of the array, but not the size:
' Array of names, first in 0 and last in 1
Dim names As String(,) { {"Joe", "John"}, {"Smith","Simpson"} }
Hope that helps!