C# Programming - Attributes - Discussion

Discussion :: Attributes - General Questions (Q.No.6)

6. 

Which of the following statements are correct about Attributes used in C#.NET?

[A]. If there is a custom attribute BugFixAttribute then the compiler will look ONLY for the BugFix attribute in the code that uses this attribute.
[B]. To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute.
[C]. To create a custom attribute we need to create a class and implement IAttribute interface in it.
[D]. If a BugFixAttribute is to receive three parameters then the BugFixAttribute class should implement a zero-argument constructor.
[E]. The CLR can change the behaviour of the code depending upon the attributes applied to it.

Answer: Option E

Explanation:

No answer description available for this question.

Raman said: (Jul 21, 2017)  
Option 1: the compiler is not looking only one attribute. It looks for other attributes as well. So its false
Option 2: For creating attribute A class is required to implement Attribute So it's false
Option 3: I have not found IAttribute Class :) It should be Attribute Class. So it's false
Option 4: It requires a parameter constructor to set attribute values. So its false
Option 5: E.g Applying XML serialisation Attribute can change the behaviour of object serialisation. So it's true.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.