Click here to Skip to main content
15,891,423 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to pass Comparison Operators as parameter to query in C#? Pin
obarahmeh4-May-09 1:26
obarahmeh4-May-09 1:26 
GeneralRe: how to pass Comparison Operators as parameter to query in C#? Pin
Eddy Vluggen4-May-09 7:09
professionalEddy Vluggen4-May-09 7:09 
GeneralRe: how to pass Comparison Operators as parameter to query in C#? Pin
obarahmeh4-May-09 22:31
obarahmeh4-May-09 22:31 
QuestionA simple question... please help Pin
Reyals4-May-09 0:08
Reyals4-May-09 0:08 
AnswerRe: A simple question... please help Pin
SeMartens4-May-09 0:16
SeMartens4-May-09 0:16 
AnswerRe: A simple question... please help Pin
OriginalGriff4-May-09 0:18
mveOriginalGriff4-May-09 0:18 
AnswerRe: A simple question... please help Pin
Reyals4-May-09 0:42
Reyals4-May-09 0:42 
AnswerRe: A simple question... please help Pin
OriginalGriff4-May-09 1:02
mveOriginalGriff4-May-09 1:02 
What does static do? Well, it is kinda important.
If you define the following:
public class Demo
    {
    public static string s1 = "Hello";
    public string s2 = "Goodbye";
    }

When you define a class, only the parts of the definition that are marked as static exist. So, if your code consists of:
static void Main()
    {
    Console.WriteLine(Demo.s1);
    }

then it works, because s1 always exists as part of the Demo class.
But you can't have:
static void Main()
    {
    Console.WriteLine(Demo.s2);
    }

because s2 only exists when you create an instance of the Demo class. Thus:
static void Main()
    {
    Demo d = new Demo();
    Console.WriteLine(d.s2);
    }

Will work. "d" is given a new instance of the Demo class, and so it has a "s2". If you create a second instance of Demo
Demo d2 = new Demo();

then d2.s2 will also exist, but this does not have to be the same as d.s2 They are separate instances.

Try to think of it this way: you can have two instances of a car - your car, and my car - and they are separate. If I crash my car into a tree, it does not affect your car. If neither of us have a car, then Ford (the car manufacturer) still exists.
"Ford" is static, it exists with or without an instance of car, but to get to the shops, I must have an instance of car for myself.

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

GeneralRe: A simple question... please help Pin
Reyals4-May-09 1:37
Reyals4-May-09 1:37 
JokeRe: A simple question... please help Pin
OriginalGriff4-May-09 1:52
mveOriginalGriff4-May-09 1:52 
QuestionFire enter key Pin
rmedo3-May-09 23:55
rmedo3-May-09 23:55 
AnswerRe: Fire enter key Pin
stancrm4-May-09 0:37
stancrm4-May-09 0:37 
AnswerRe: Fire enter key Pin
Member 44703544-May-09 0:50
Member 44703544-May-09 0:50 
GeneralRe: Fire enter key Pin
rmedo4-May-09 2:46
rmedo4-May-09 2:46 
QuestionSQL SCRIPT Pin
kibromg3-May-09 23:20
kibromg3-May-09 23:20 
AnswerRe: SQL SCRIPT - cross post Pin
Mycroft Holmes3-May-09 23:25
professionalMycroft Holmes3-May-09 23:25 
QuestionCtrl+A short key in listview Box Pin
S K Y3-May-09 23:11
S K Y3-May-09 23:11 
AnswerRe: Ctrl+A short key in listview Box Pin
Christian Graus3-May-09 23:14
protectorChristian Graus3-May-09 23:14 
AnswerRe: Ctrl+A short key in listview Box Pin
sbscb3-May-09 23:23
sbscb3-May-09 23:23 
Questiondrag node with its childs from one tree to other Pin
Nomz1233-May-09 23:06
Nomz1233-May-09 23:06 
AnswerRe: drag node with its childs from one tree to other Pin
Mycroft Holmes3-May-09 23:28
professionalMycroft Holmes3-May-09 23:28 
GeneralRe: drag node with its childs from one tree to other Pin
Nomz1233-May-09 23:30
Nomz1233-May-09 23:30 
GeneralRe: drag node with its childs from one tree to other Pin
Mycroft Holmes3-May-09 23:54
professionalMycroft Holmes3-May-09 23:54 
GeneralRe: drag node with its childs from one tree to other Pin
Nomz1233-May-09 23:58
Nomz1233-May-09 23:58 
GeneralRe: drag node with its childs from one tree to other Pin
Dave Kreskowiak4-May-09 5:03
mveDave Kreskowiak4-May-09 5:03 

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.