In C# gibt es keine globalen variablen, aber man kann statische felder
eines typen dazu benutzen.

public class Globals
{
        private static string _aGlobalString;
        public static string AGlobalString
        {
                get
                {
                        return _aGlobalString;
                }
                set
                {
                        _aGlobalString = value;
                }
          }
}

public class App
{
        public static void Main(string[] args)
        {
                Globals.AGlobalString = "Hola";
                Console.WriteLine(Globals.AGlobalString);
        }
} 

Saludos,
Germ�n Fern�ndez

-----Mensaje original-----
De: Stephan Hartmann [mailto:[EMAIL PROTECTED]] 
Enviado el: lunes, 12 de agosto de 2002 13:41
Para: C Sharp
Asunto: [dotnetdecsharp] Globale Variable

Hallo Liste,
�
h�rt sich vielleicht bl�d an, aber wie und wo deklariere ich eine
globale Variable (z.B. Datenbankconnection, angemeldeter User etc. pp.),
die in der gesamten Applikation sichtbar ist? (in C++ hat man's einfach
hingeschrieben ;-)
�
Gr��e Stephan
| [dotnetdecsharp] als [EMAIL PROTECTED] subscribed |
http://www.dotnetgerman.com/archiv/dotnetdecsharp/ = Listenarchiv |
Listenregeln, sowie An- und Abmeldung zu dieser Liste: |
http://www.dotnetgerman.com/listen/dotnetdecsharp.asp 

| [dotnetdecsharp] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/dotnetdecsharp/ = Listenarchiv
| Listenregeln, sowie An- und Abmeldung zu dieser Liste:
| http://www.dotnetgerman.com/listen/dotnetdecsharp.asp

Antwort per Email an