[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# Syntax Question

Posted on 2014-03-21
2
Medium Priority
?
300 Views
Last Modified: 2014-03-21
In doing some code review I have encountered something I'm not familiar with:

namespace test
{
[I1ActiveReport("/Reports/..., ReportAccess.userAccount, "Description"]
   public class Name : I1ActiveReport
   {
      ...
   }
}

And then again in a different example, inside a property:

protected className I1Parameters
{
[System.Diagnostics.DebuggerStepThrough]
   get
   {
       ...
    }
}

What do those brackets [  ]   do?
0
Comment
Question by:pzozulka
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1000 total points
ID: 39946485
It's an attribute. Attributes are kind of like meta-programming. They have a variety of uses, and are more of an advanced topic--at least creating them is.
0
 
LVL 64

Assisted Solution

by:Fernando Soto
Fernando Soto earned 1000 total points
ID: 39946486
Hi pzozulka;

They are attributes associated with a class, property function and so on and during execution can be accessed using reflections. Please see MS Documentation.

Attributes (C# and Visual Basic)
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question