Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In .NET is it faster to use the Attribute suffix even though it is not required?

MSDN states that

you do not need to specify the attribute suffix when using attributes in code

Example: You have an attribute named HelpAttribute. You can decorate a property with [Help] (no Attribute suffix) or with [HelpAttribute]; either is allowable. But, does the code run faster when you use the full attribute name rather than the non-suffixed name?

like image 364
300 baud Avatar asked Aug 02 '10 15:08

300 baud


People also ask

Is .NET 7 fast?

Regarding performance, . NET 7 is being called the fastest . NET yet, with more than 1,000 performance-impacting improvements, Microsoft officials said in a September 14 blog post.

Which is the operator that Cannot operate on pointers in an unsafe context?

Because the referent type is unknown, the indirection operator cannot be applied to a pointer of type void* , nor can any arithmetic be performed on such a pointer.

How would you define a custom attribute that can only be applied to class code elements?

The following code fragment specifies that a custom attribute can be applied to any class or method: C# Copy. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] End Class.


1 Answers

The code compiles down to the exact same IL and has 0 runtime performance difference.

like image 60
JaredPar Avatar answered Sep 28 '22 00:09

JaredPar