|
-
Mar 26th, 2003, 08:23 AM
#1
Thread Starter
Sleep mode
Static variable ?[Resolved]
Can I delcare static variable in C# ?? I looked into the help , it says do this but gave me an error :
static System.Data.DataSet ds;
what's wrong ?
Last edited by Pirate; Mar 26th, 2003 at 10:21 AM.
-
Mar 26th, 2003, 10:00 AM
#2
-
Mar 26th, 2003, 10:02 AM
#3
Thread Starter
Sleep mode
It says expected error ?? I don't why ?
-
Mar 26th, 2003, 10:03 AM
#4
I am assuming you are trying to decalre static at the function scope, I think you can only declare static variables at the class scope ie
Code:
public class myclass
{
static string mystr;
}
-
Mar 26th, 2003, 10:08 AM
#5
Thread Starter
Sleep mode
But I need it inside a function , it's possible , isn't ?
-
Mar 26th, 2003, 10:12 AM
#6
Thread Starter
Sleep mode
Weird , it's working when it's outside the function ??? In VB I can declare it anywhere !!!!
-
Mar 26th, 2003, 10:12 AM
#7
Not that I can tell. At any rate, it will still do that same job at the class scope.
-
Mar 26th, 2003, 10:13 AM
#8
C# is more bitchy than VB.
-
Mar 26th, 2003, 10:15 AM
#9
Thread Starter
Sleep mode
Originally posted by Cander
C# is more bitchy than VB.
lol , yes it is . Is this conversion right ?
VB.NET
If ds Is Nothing
C#
if (ds ==null)
{
}
??
-
Mar 26th, 2003, 10:17 AM
#10
-
Mar 26th, 2003, 10:20 AM
#11
Thread Starter
Sleep mode
yessssssss , Now I'm done with my database dll C# version .
Thank you Cander !
-
Mar 26th, 2003, 10:21 AM
#12
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
|