I just came across this:
VB Code:
Dim objarrlist As New System.Collections.ArrayList objarrlist.Add(" "c)
How can we have a string followed by a c here? What exactly is this doing?
Printable View
I just came across this:
VB Code:
Dim objarrlist As New System.Collections.ArrayList objarrlist.Add(" "c)
How can we have a string followed by a c here? What exactly is this doing?
c=Char .
so , you can only store one char type .
This can clears it up :
VB Code:
Dim objarrlist As New System.Collections.ArrayList objarrlist.Add(" "c) Dim t As Type = objarrlist(0).GetType MessageBox.Show(t.ToString)
So you mean, just one instance of a character in the entire array list?
Can there be other options instead of c?
Looks like we posted at the same time.
I see that it converts whatever is in the string to a character.
Can this "z"c syntax be used in other places in VB.NET or is it specific to the arraylist?
No , that would specify the type of the element you add . You can add char at index 0 , string at 1 , object at index 2 ..etc
Other uses for c is this (basically used with ToString method)Quote:
Originally posted by mendhak
Looks like we posted at the same time.
I see that it converts whatever is in the string to a character.
Can this "z"c syntax be used in other places in VB.NET or is it specific to the arraylist?
VB Code:
Dim c As Double = 102.01 Dim s As String = c.ToString("c") MessageBox.Show(s)
for the complete list (D,d(for dates) , c ...etc) check MSDN Help (Formatting Overview)
Thanks a lot buddy.
Who's that in your avatar? Or did that bird-flippin' baby suddenly grow old?
No , that's just to make Brad happy . :sick: :sick: . I had a lot of troubles with admins here all because of that baby who never grows up .:bigyello:Quote:
Originally posted by mendhak
Who's that in your avatar? Or did that bird-flippin' baby suddenly grow old?
:afrog: