What do brackets mean?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fluxcapacitor
    New Member
    • Mar 2007
    • 4

    #1

    What do brackets mean?

    Language - C#

    I'm relatively new to dotnet, i read on msdn almost every day, there are many great examples of code and it is an invaluable resource, but i can't find anywhere that explains in what context things like
    Code:
    [SerializableAttribute]
    fit, whats with the brackets..what does it all mean???

    Please help me, I'm stupid.

    for example:-

    Code:
    [SerializableAttribute] 
    [ClassInterfaceAttribute(ClassInterfaceType.AutoDual)] 
    [ComVisibleAttribute(true)] 
    public abstract class Delegate : ICloneable, ISerializable
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by fluxcapacitor
    Language - C#

    I'm relatively new to dotnet, i read on msdn almost every day, there are many great examples of code and it is an invaluable resource, but i can't find anywhere that explains in what context things like
    Code:
    [SerializableAttribute]
    fit, whats with the brackets..what does it all mean???

    Please help me, I'm stupid.

    for example:-

    Code:
    [SerializableAttribute] 
    [ClassInterfaceAttribute(ClassInterfaceType.AutoDual)] 
    [ComVisibleAttribute(true)] 
    public abstract class Delegate : ICloneable, ISerializable
    These are called attributes. If you google for "C#" Attributes, you'll find tutorials. They are used to define metadata about classes, methods, or properties within your assembly. They are also used to mark chunks of code that will only be included in Debug builds or routines that are obsolete. For example, I just made a major design change which affected zillions of modules. We maked a large number of these as obsolete, so that we could still get a clean compile. However, any code that called these routines was flagged by the compiler as a Warning. Thus we can look at the warnings, decide what to tackle next, but still know that we haven't made any stupid coding errors.

    You can also get help on these attributes; for example, SearializableAt tribute is at http://msdn2.microsoft.com/en-us/lib...attribute.aspx. HTH --Sam

    Comment

    Working...