0

Hey all ,,,,
basicly i come from a vb language to c# and i'm using couple of varables and constant that i'm using upon all my project so is there any way that i can set like a public variable that i can use every time i need or even a publicc method or something like that ??

2
Contributors
3
Replies
24
Views
3 Years
Discussion Span
Last Post by deceptikon
1

The closest you can get would be a static class in C# with those variables as members. Place that class in a shared assembly (if your project uses more than one assembly) and you're good to go.

Votes + Comments
thaks
0

Dear deceptikon ,
i'm new to C# so is there is any way that you can provide with an example snippet or with way to do it
and thanks in advance.

0
public static class Globals
{
    public static readonly string Foo = "DAFOO";
}

...

Console.WriteLine(Globals.Foo);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.