panJacek
asked on
Global variable passed as method parameter
Hello Experts :-)
I am newbie to C#, I have Delphi background so my approach is kind of Delphi style and maybe this is wrong for C#...
Anyway, here comes my question:
I want to create my own enum variable to be used across the whole application.
I created new static class, inside this class I created my enum variable.
I can use this variable inside other classes which is fine but I would also like to use it as a method parameter.
Compiler does not allow me to do it saying that this is a field not a variable.
How can I use my global field as variable then?
Thank you
panJacek
I am newbie to C#, I have Delphi background so my approach is kind of Delphi style and maybe this is wrong for C#...
Anyway, here comes my question:
I want to create my own enum variable to be used across the whole application.
I created new static class, inside this class I created my enum variable.
I can use this variable inside other classes which is fine but I would also like to use it as a method parameter.
Compiler does not allow me to do it saying that this is a field not a variable.
How can I use my global field as variable then?
Thank you
panJacek
bring sample code of what you want to do here
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
public static class GlobalVariables
{
public enum XYZ
{
x, y, z
}
}
public class AnotherClass
{
public AnotherClass(XYZ aParam)
{
}
}
It will not compile.
panJacek
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.