|
-
Jun 4th, 2004, 12:22 AM
#1
Array List Add(" "c) - [Resolved]
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?
Last edited by mendhak; Jun 4th, 2004 at 01:33 AM.
-
Jun 4th, 2004, 01:11 AM
#2
Sleep mode
c=Char .
so , you can only store one char type .
-
Jun 4th, 2004, 01:14 AM
#3
Sleep mode
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)
-
Jun 4th, 2004, 01:15 AM
#4
So you mean, just one instance of a character in the entire array list?
Can there be other options instead of c?
-
Jun 4th, 2004, 01:16 AM
#5
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?
-
Jun 4th, 2004, 01:17 AM
#6
Sleep mode
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
-
Jun 4th, 2004, 01:23 AM
#7
Sleep mode
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?
Other uses for c is this (basically used with ToString method)
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)
-
Jun 4th, 2004, 01:27 AM
#8
Thanks a lot buddy.
Who's that in your avatar? Or did that bird-flippin' baby suddenly grow old?
-
Jun 4th, 2004, 01:36 AM
#9
Sleep mode
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|