Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
GeneralRe: the static keyword Pin
N a v a n e e t h10-Oct-07 0:51
N a v a n e e t h10-Oct-07 0:51 
GeneralRe: the static keyword Pin
Christian Graus10-Oct-07 0:57
protectorChristian Graus10-Oct-07 0:57 
AnswerRe: the static keyword Pin
Guffa10-Oct-07 1:13
Guffa10-Oct-07 1:13 
GeneralRe: the static keyword Pin
Christian Graus10-Oct-07 1:19
protectorChristian Graus10-Oct-07 1:19 
GeneralRe: the static keyword Pin
Guffa10-Oct-07 1:49
Guffa10-Oct-07 1:49 
GeneralRe: the static keyword Pin
Dextter10-Oct-07 1:14
Dextter10-Oct-07 1:14 
AnswerRe: the static keyword Pin
Guffa10-Oct-07 1:51
Guffa10-Oct-07 1:51 
GeneralRe: the static keyword Pin
Rob Philpott10-Oct-07 2:05
Rob Philpott10-Oct-07 2:05 
Hi Obinna,

Going back a bit because you're probably not familiar with multiple threading yet, the static keyword marks the variable as being shared across all instances of the class.

so for instance if you have a class member which is an int:

public class MyClass
{
    int z;
}

each and every instance of that class you create (new MyClass()) will have its own z, which can and usually will be different.

when its static:

public class MyClass
{
    static int z;
}

then each and every instance shares just a single z. If you change it in one instance, it will change in all instances. As said previously, this could be useful if you wanted to maintain a count of how many instances are in existence and have that variable in class scope.

Similiarly, if you had a database connection string, that would be the same for each instance so you would mart it static so that you didn't create multiple copies of the same thing but instead just have one which each instance can access.




Regards,
Rob Philpott.

QuestionStarting animation defined in XAML from code Pin
donovan.solms10-Oct-07 0:23
donovan.solms10-Oct-07 0:23 
AnswerRe: Starting animation defined in XAML from code Pin
Christian Graus10-Oct-07 0:28
protectorChristian Graus10-Oct-07 0:28 
GeneralRe: Starting animation defined in XAML from code Pin
donovan.solms10-Oct-07 13:59
donovan.solms10-Oct-07 13:59 
QuestionCalling part of a function Pin
Muammar©10-Oct-07 0:22
Muammar©10-Oct-07 0:22 
AnswerRe: Calling part of a function Pin
Christian Graus10-Oct-07 0:40
protectorChristian Graus10-Oct-07 0:40 
GeneralRe: Calling part of a function Pin
Muammar©10-Oct-07 1:12
Muammar©10-Oct-07 1:12 
QuestionConvert PDF to HTML, or control Acrobat to save as HTML Pin
shea8519-Oct-07 23:13
shea8519-Oct-07 23:13 
AnswerRe: Convert PDF to HTML, or control Acrobat to save as HTML Pin
Christian Graus9-Oct-07 23:31
protectorChristian Graus9-Oct-07 23:31 
GeneralRe: Convert PDF to HTML, or control Acrobat to save as HTML Pin
shea85110-Oct-07 0:18
shea85110-Oct-07 0:18 
GeneralRe: Convert PDF to HTML, or control Acrobat to save as HTML Pin
Christian Graus10-Oct-07 0:29
protectorChristian Graus10-Oct-07 0:29 
GeneralRe: Convert PDF to HTML, or control Acrobat to save as HTML Pin
shea85110-Oct-07 2:14
shea85110-Oct-07 2:14 
GeneralRe: Convert PDF to HTML, or control Acrobat to save as HTML Pin
martin_hughes10-Oct-07 3:06
martin_hughes10-Oct-07 3:06 
AnswerRe: Code for inesrt,delete,update,view Pin
Christian Graus9-Oct-07 23:33
protectorChristian Graus9-Oct-07 23:33 
QuestionHow inherit just what I need. Pin
MaCheNomeVuoi9-Oct-07 23:06
MaCheNomeVuoi9-Oct-07 23:06 
AnswerRe: How inherit just what I need. Pin
Christian Graus9-Oct-07 23:34
protectorChristian Graus9-Oct-07 23:34 
Question[Message Deleted] Pin
bruze9-Oct-07 22:51
bruze9-Oct-07 22:51 
AnswerRe: Code Pin
Mustafa Ismail Mustafa9-Oct-07 23:04
Mustafa Ismail Mustafa9-Oct-07 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.