Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 186251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:36:51+00:00 2026-05-11T15:36:51+00:00

I have seen a lot of C# programs that use the [] , for

  • 0

I have seen a lot of C# programs that use the [], for example [STAThread] and then the code follows. Another classic example is [DLLImport].

I know what STAThread means but my question is what is the significance of the square brackets, essentially what do they tell the compiler?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:36:51+00:00Added an answer on May 11, 2026 at 3:36 pm

    It’s an attribute. Attributes are a form of metadata that you can attach to various code elements: classes, methods, assemblies etc.

    Some attributes have special meaning to the C# compiler, for instance the [Serializable] probably tells the compiler to emit some code that can serialize an instance of the class (I say ‘probably’ since I do not know the inner workings of the C# compiler).

    You can also create your own attributes (by inheriting System.Attribute). Using reflection you could then at run-time extract information from the attributes.

    A simple example would be to create an attribute to specify what kind of input field to use in a HTML form when displaying an object’s property.

    Some links:

    • Book chapter on attributes
    • Attributes overview (MSDN)
    • https://stackoverflow.com/search?q=C%23+attributes
    • http://www.google.com/search?q=C%23+attributes
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen a lot of software that show that which registry has error.
I have seen a lot of mobile phone apps that just open a web
I have seen lot projects following this kind of coding style Any significant advantage
I have seen a lot of people in the C++ community(particularly ##c++ on freenode)
I have seen a lot of old articles on SO. So i am asking
i have seen a lot of screencasts where the author is creating methods with
I have seen a lot of articles on this, but none dealing with jQuery,
I have seen a lot of shared hashmap implementations. Here is the specific scenario
Ok. I HAVE seen a LOT of topics which are similar to what I'm
I'm new to building jQuery plugins. I have seen and used a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.