Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

[system.Diagnostics.DebuggerStepThroughtAttributes()]

public EchoServer(){

...

}

 

[WebMethod]

public string Echo(string ms){

 

}

 

[sTAThread]

static void main(){

 

}

 

What are those [] block?

I know it's called attribute.. But, I haven't find any article about it..

I need to know syntax, architecture of it..

I haven't seen those from VB, Java...or other language..

Please reply with explanation or any source links..

 

Thank you all

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

  • *Experts*
Posted

[mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/csref/html/vclrfIntroductionToAttributes.htm]Here we go[/mshelp].

 

In VB.NET, attributes are put inside < and > characters.

 

There is also a typo in your first sub, EchoServer; it should be

System.Diagnostics.DebuggerStepThroughAttribute()

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted

The attributes (also called decorations as in, "decorate the method EchoServer with the DebuggerStepThroughAttribute attribute") are extra info for the compiler.

 

There are a bunch of them and you use them for a variety of reasons. For instance, "[WebMethod]" marks a method as a webservice so that the compiler can generate the proper code. You can add simple attributes like Description to describe a property:

[Description("The Min value")]
public int MinValue
{
// property code would go here...
}

 

Assuming the above were part of a user control, the "Description" attribute lets the Property window (in design time) show the description.

 

If you have any attributes particular you have questions about, ask away :)

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Thank you .

now I got little clue for that.

It's very strange that I never found former document or book describing about this out of more than 20 .net books and various articles..

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

  • *Experts*
Posted

Other than [WebMethod], you normally won't encounter attributes in many beginner books/tutorials. Not that they're advanced features by any stretch, it's just that there's so much to learn about .NET that they often get overlooked.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

That's true..

As more I learn .net, I face more deep and wide concepts of Computer science.

There are nothing to throw out from what I learn from school; network, security, grammer, oop, Soft engineering, graphic, math, algorithms.......

 

If anyone study computer science now, never look down what you are learning from class room!!!

Even though you don't feel it's necessary, those will be stable corner stone for your life span compurter science career..

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...