Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is Empty or Null
Message
From
20/03/2008 06:52:21
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01303548
Message ID:
01303777
Views:
18
>>>Hi,
>>>
>>>>btw, do you know why IsNullOrEmpty() is a static method ?
>>>
>>>>My guess is, that it would error if the string would be null if it were a non-static method as in
>>>>
>>>>string s = 'abc';
>>>>
>>>>var xx = s.IsNullOrEmpty();
>>>>
>>>>s = null
>>>>xx = s.IsNullOrEmpty(); // error I think
>>>>
>>>>
>>>It's static so you're syntax is wrong( also this is C#2.0 so 'var' isn't available). But the following works:
>>>string s = "abc";
>>>bool  xx = string.IsNullOrEmpty(s);
>>>s = null;
>>>xx = string.IsNullOrEmpty(s);
>>>Best,
>>>Viv
>>___
>>
>>Viv,
>>
>>I know that the syntax is wrong. My point was that IsNullOrEmpty() _has_ to be a static method, since if the string were null, one could not use a non-static method
>
>Hi,
>OK I see what you mean. But isn't it irrelevant since neither occurrence would get past the compiler?
>
>>ps: I'm using vs2008 - so I can use 'var'
>I guess I interpret the version C#2.0 to mean C#2005. C#2008, in the same vein would be C#3.5 - but I'm nitpicking. Now you've got me wondering whether one can use VS2008 to build C#2005 applications :-}

Dunno whether this will answer your question, but ..
In the project properties (where one specifies the assembly name and default namespace), there is a Target Framework
Choices are
- .Net Framework 3.5
- .Net Framework 3.0
- .Net Framework 2.0

So, my guess is Yes, you can
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform