Reputation:
How can I mark that MyClass is not possible to be reviewed but has a test suit.
public class MyClass
{
}
public class MyAttribute : System.Attribute
{
bool Reviewed { get; set; }
bool HasTestSuit { get; set; }
}
Upvotes: 0
Views: 81
Reputation: 12731
try this.
Declare a constructor in MyAttribute class.
public class MyAttribute : System.Attribute
{
bool Reviewed { get; set; }
bool HasTestSuit { get; set; }
public MyAttribute(bool hasReviewed,bool hasTestSuite)
{
this.Reviewed = hasReviewed;
this.HasTestSuit = hasTestSuite;
}
}
Now set the attribute as shown below.
[MyAttribute(false, true)]
public class MyClass
{
}
You can understand more on custom attributes by walking through the below link.
https://msdn.microsoft.com/en-us/library/84c42s56(v=vs.110).aspx
Upvotes: 1
Reputation: 47510
[MyAttribute(false, true)]
public class MyClass
{
}
public class MyAttribute : System.Attribute
{
public MyAttribute(bool reviewed, bool hasTestSuit)
{
this.Reviewed = reviewed;
this.HasTestSuit = hasTestSuit;
}
bool Reviewed { get; set; }
bool HasTestSuit { get; set; }
}
Upvotes: 0