I have a problem with the var keyword
I have defined it like this at the form load
public partial class form1 :form
{
public var a;
private void form1_load(object sender, eventargs e)
{
// i have used "a" like this....
a = abc.members blahhhh blahhhhh
bindingsource1.datasource = a;
datagridview1.datasource = bindingsource1;
}
}
but I got the error on this line
public Var a;
the type or namespace name ‘var’ could not be defined
Can I define public class varaible so that I can access this all methods in that class?
varin C# is different fromvarin other languages; in C# you usevarto have the compiler determine the type of a certain local variable for you, but you cannot use it to declare fields/properties.You have to specify the actual type instead. I have no idea what
ais, so I can’t tell you what type to use.