rickpost

rickpost

  • NA
  • 3
  • 0

Class to hold global variables

Sep 6 2007 9:53 AM

Hello,

I'm a newbie to C#, but I've been programming in OO languages for 15 years.

What I want to do is have a custom class to hold some variables that I need to access from different parts of the application. It would also be awesome to bind these variables to visual controls throughout the application. I tried to use a class with static members and static get/set methods. This worked fine for access throughout the app, but when I tried to do some databinding, my methods and members were not visible.

Here is a snippet of what my class looks like.

public class Globals
{
    public static string UserID
    {
        get { return Globals.sUserID; }
        set { Globals.sUserID = value; }
    }
}


What do I need to do in order to use this class for databinding?

Thank you!!

Rick


Answers (1)