Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will there be generic attributes in C# 4? [closed]

So - if there isn't particular reason why there isn't generic attributes,
I'm wondering - maybe they will be implemented?

Those would be great for ASP.NET MVC action filters.

like image 594
Arnis Lapsa Avatar asked Jul 31 '09 07:07

Arnis Lapsa


People also ask

Can attributes be generic?

Attributes can be applied to generic types in the same way as non-generic types.

Are generics in C?

It allows efficient development without the need to incorporate or switch to C++ or languages with builtin template systems, if desired. Using generics and templates in C can also make programs more type safe, and prevent improper access of memory.

How do you find a generic type?

Use the IsGenericType property to determine whether the type is generic, and use the IsGenericTypeDefinition property to determine whether the type is a generic type definition. Get an array that contains the generic type arguments, using the GetGenericArguments method.

What are attributes in C#?

In C#, attributes are classes that inherit from the Attribute base class. Any class that inherits from Attribute can be used as a sort of "tag" on other pieces of code. For instance, there is an attribute called ObsoleteAttribute . This is used to signal that code is obsolete and shouldn't be used anymore.


1 Answers

I haven't seen any evidence of this in the 4.0 spec... so I believe the answer is "no".

like image 152
Marc Gravell Avatar answered Oct 01 '22 12:10

Marc Gravell