PDA

View Full Version : vb.net what does [object] mean


allida77
06-11-2003, 06:12 PM
What do the [] mean around objects? I have seen this in some sample code and not sure what it means.

Return [String].Empty

arnyinc
06-11-2003, 10:23 PM
I asked someone about it and he said it is used for C# attributes and reflection. Attributes help you shorten your code and define things implicitly. I hope that helps at least a little bit. Maybe you can find more info on those things.

ReyN
06-12-2003, 05:12 AM
i really don't know why some sample codes, particularly in VB.NET, do have that.

i believe this is just to denote the type of an object. and with whatever little experience i've had with VB.Net ( for the past year and a half or so ), the brackets around type keywords aren't really necessary.

you can simply exclude them and the code would still work.

btw, you can't really do this [ enclose types in brackets ] in C#. the compiler will throw an exception, as brackets [ ] in C# denote something else, such as an indexer for a collection, or an array type.