CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2001
    Location
    US
    Posts
    47

    What syntactically is going on with [STAThread]?

    I know that we are selecting a threading model, but what C# syntax feature is

    [object] rettype funcname (args)?

    Im learning C# and it bugs me to not know why the compiler likes this.

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    MTA/STA models are the threading models supported by C#. the main is the entry point of the C#.NET exe so it starts in STA mode for instance

    you could check
    VS.NET help

    -Paresh
    - Software Architect

  3. #3
    Join Date
    May 2001
    Location
    US
    Posts
    47
    Im not interested in what the STAThread means, but what is going on syntactically.

    It looks like an array access prior to a function declaration. Im wondering if a C# person can explain it further.


    ie:

    [somethinghere] int main(void);

  4. #4
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    its known as attribute which defines the behaviour of that method for example if you make the usercontrol,
    and add a property,

    private static readonly short nT;
    [Category("Static"),Description("Set/Get Total"),Browsable(true)]
    public static short TC
    {
    get { return nT; }
    }

    [cate...]
    are the attributes for the property TC
    which will show up in the designer view of the usercontrol property when u drag and drop it.

    Paresh
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured