Re: Two things that bug me about C#

From: Rakesh Rajan (rakesh-no-spam-rajanhere_at_hotmail.com)
Date: 09/25/04


Date: Sat, 25 Sep 2004 22:26:00 +0530

Hi mb,

Instead of having global variables disorganized by being "all around", you
could organize your global var's in a more formal class. In C++ etc. , you
will have one BIG chunk of global variables.....here couldn't you have more
organization? It's the same case with methods as well.

In C#, everything is within a class, and everything derives from
System.Object...this arch is nicely added on with that arch as well.

HTH,
- Rakesh Rajan

"mb" <mm@hotmail.com> wrote in message
news:OuUxiyxoEHA.1816@TK2MSFTNGP09.phx.gbl...
> 1) you can't declare anything outside of a class, enum, etc. Thus you
can't
> declare globals right after the namespace declaration. I just don't
> understand why Microsoft decided to do away with easy to
> use/declare/understand global variables. Even C++ can do this. I used to
> put globals all in one spot for easy maintaining, this is intuitive. Now
> they are spread all over the code, in different classes as "static"
> variables, which to access I have to write out the full class and veriable
> name.
>
> 2) Almost along the same lines, I can't just create a function, I have to
> create a class first, and thus waste time and space. Then if I don't make
> the function static, I have to instantiate the class just to use the
> function.
>
> This is just my lowly opinion as a beginning C# programmer.
>
>



Relevant Pages

  • RE: scope of public variables
    ... "Jim Thomlinson" wrote: ... If your globals are declared anywhere other than a standard code module ... is where did you declare your variable. ... Sub optCkforDupes_Click ...
    (microsoft.public.excel.programming)
  • Re: global variables
    ... Dim NumberOfPairs As Integer ... fine like that, they are not globals, but Form level variables. ... declare those at the form level to restrict scope to each Form. ...
    (comp.lang.basic.visual.misc)
  • Two things that bug me about C#
    ... you can't declare anything outside of a class, enum, etc. ... use/declare/understand global variables. ... put globals all in one spot for easy maintaining, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: my variable is recognized in following sub
    ... x> Aren't global variables the same thing as package variables? ... at least not in Perl vernacular as I understand it. ... if you declare a lexical variable in the body of a perl source file ... called file globals as they are usually global to the entire file (even ...
    (comp.lang.perl.misc)
  • Re: Two things that bug me about C#
    ... > 1) you can't declare anything outside of a class, enum, etc. ... > declare globals right after the namespace declaration. ... > put globals all in one spot for easy maintaining, ...
    (microsoft.public.dotnet.languages.csharp)