0
the static dataSet will be the same for every form. That's the fun part of static members.
The static member doesn't dependon an instance of that class. It can be called directly.
Just try it and you will see.
0
Quote:
"You could write in any Form object:
OneInstance.Data = new DataSet();
Wich will provide the class a new DataSet. And as you see you don't even need a
instance of the object. "
then you make on each form a new dataset?
because i want to use 1 dataset that stays te same for each form
0
You can create a class with all static members.
The internal variables are private static and functions and properties are public static.
Even the constructor is static.
Working with a static constructor has one disadvantage. It can't take any parameters. Because everything is static it doesn't hold any reference to the class it's in. But they are accessible from everywhere.
You could write in any Form object:
OneInstance.Data = new DataSet();
Wich will provide the class a new DataSet. And as you see you don't even need a instance of the object.
public class OneInstance
{
static DataSet ds = null;
public static OneInstance()
{
//TODO: constructor logic
}
public static DataSet Data
{
get{return ds;}
set{ds = value;}
}
}
I hope this helps.
0
the class keeps a dataset that he loads on the initialization
0
What's the functionality of that class?
Else you could simple use a class with only static members.