C# Programming - Attributes - Discussion
Discussion Forum : Attributes - General Questions (Q.No. 3)
3.
Which of the following are correct ways to pass a parameter to an attribute?
- By value
- By reference
- By address
- By position
- By name
Discussion:
6 comments Page 1 of 1.
Nisha said:
2 years ago
I think we can pass the value and reference only.
Sridhar said:
5 years ago
Option A we can pass parameters by using cal by value and cal by ref.
Raman said:
6 years ago
According to me, the answer seems to me Wrong. It can be positional or named only.
K2u2007 said:
8 years ago
Positional vs. Named Parameters.
In the preceding example, RemarkAttribute was initialized by passing the description
string to the constructor, using the normal constructor syntax. In this case, the comment
parameter to RemarkAttribute( ) is called a positional parameter. This term relates to the fact
that the argument is linked to a parameter by its position in the argument list. Thus, the first
argument is passed to the first parameter, the second argument is passed to the second
parameter, and so on.
However, for an attribute, you can also create named parameters, which can be assigned
initial values by using their name. In this case, it is the name of the parameter, not its
position, that is important.
NOTE Although named attribute parameters are conceptually similar to named arguments in methods, the specifics differ.
In the preceding example, RemarkAttribute was initialized by passing the description
string to the constructor, using the normal constructor syntax. In this case, the comment
parameter to RemarkAttribute( ) is called a positional parameter. This term relates to the fact
that the argument is linked to a parameter by its position in the argument list. Thus, the first
argument is passed to the first parameter, the second argument is passed to the second
parameter, and so on.
However, for an attribute, you can also create named parameters, which can be assigned
initial values by using their name. In this case, it is the name of the parameter, not its
position, that is important.
NOTE Although named attribute parameters are conceptually similar to named arguments in methods, the specifics differ.
Gjkgkhgjk said:
9 years ago
How it is possible can anybody please tell ?
John said:
10 years ago
How it is possible can anybody please tell ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers