|
-
Jun 2nd, 2004, 07:32 AM
#1
Thread Starter
Hyperactive Member
How to check if a string array has been initialized **SOLVED**
Hey all, this seems to be easy but I cant seem to figure out how to check if a string array has already been initialized?
If I have public string [] attachments; defined in my class.
No I want to check if the array has got any values in it, but if I do,
if (attachments.Length !=0)
I get an error saying:
Object reference not set to an instance of an object.
So how do I check if my array has already been initialized or not?
Thanks Stephan
Last edited by Sgt-Peppa; Jun 2nd, 2004 at 08:00 AM.
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Jun 2nd, 2004, 07:55 AM
#2
Addicted Member
try checking if attachments == null
-
Jun 2nd, 2004, 07:59 AM
#3
Thread Starter
Hyperactive Member
I knew it was easy, but that easy,......
This is so emberassing, must be a very bad coding day for me,...
Thanks a lot,
it works (of course it does,.....)
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
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
|