Programming with Attributes
page 2 of 4
by Kavitha Pradeep
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 22800/ 49

Attribute Based Programming in .NET

The Microsoft .NET Framework makes life easy by extensively supporting attributes.  You could add flavor to your code by using the existing attributes or you could define and design your own attributes. The base class for attributes is System.Attribute. 

Using existing attributes is relatively easier and Microsoft has provided you with a huge list of attributes that you could use.  You must have definitely developed simple console applications.

static void Main(string[] args)


The [STAThread ] annotated before the main method is an attribute that marks a thread to use the Single-Threaded COM Apartment if COM is needed. SImilary if you have developed web services than you must have seen the attribute [webmethod] annotated before methods act as web services. Thus using these attributes is pretty easy .

We shall now delve into how to write our own custom attributes. Writing custom attribute greatly helps in annotating pieces of software code according to our needs. The basis for Attributes is the System.Attribute class.

View Entire Article

User Comments

Title: very very nice article   
Name: kasi
Date: 2012-03-17 5:48:04 AM
thanks you very very very much Kavitha Pradeep..a nice article

i hope please write one more on attribute based programming

i am waiting
Title: good Example for Attributes   
Name: Sivakumar
Date: 2007-09-05 2:49:09 AM
good Example for Attributes
Title: so cool   
Name: prince
Date: 2006-02-13 7:45:48 AM
thanks a lot, this website is very useful for me
Title: Good Site   
Name: Anju
Date: 2006-02-10 7:47:42 AM
I found it very useful.
Title: comments   
Name: sanjeev
Date: 2005-12-29 5:25:10 AM
very good site
Title: great   
Name: devil
Date: 2005-01-18 4:36:48 AM
good artical i was searching for this [STAThread]...anyway nice work...want ur help if u r interested as i am a novice programmer into the world of .net...

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-02-27 1:05:44 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search