L
lucius
I have a custom Attribute Class that decorates a primary class like in
the example below. I would now like to decorate the primary class with
the Attribute, but let the Attribute do a runtime evaluation of an
expression and throw if it fails the expression. Can someone show me
how to rewrite the CustomClassAttribute to support this?
Thanks.
Current pseudocode -
[CustomClassAttribute( SecondaryClass , ClassProperty , 1 )]
class PrimaryClass
{
....
}
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Method,
AllowMultiple = true)]
public class CustomClassAttribute : System.Attribute
{
public CustomClassAttribute ( Type someType , Int someProperty
, Int intValue )
{
...
}
}
Wanted pseudocode -
[CustomClassAttribute( "SomeType.InstanceProperty > 1" )]
class PrimaryClass
{
....
}
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Method,
AllowMultiple = true)]
public class CustomClassAttribute : System.Attribute
{
public CustomClassAttribute ( string checkExpression )
{
...
}
}
the example below. I would now like to decorate the primary class with
the Attribute, but let the Attribute do a runtime evaluation of an
expression and throw if it fails the expression. Can someone show me
how to rewrite the CustomClassAttribute to support this?
Thanks.
Current pseudocode -
[CustomClassAttribute( SecondaryClass , ClassProperty , 1 )]
class PrimaryClass
{
....
}
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Method,
AllowMultiple = true)]
public class CustomClassAttribute : System.Attribute
{
public CustomClassAttribute ( Type someType , Int someProperty
, Int intValue )
{
...
}
}
Wanted pseudocode -
[CustomClassAttribute( "SomeType.InstanceProperty > 1" )]
class PrimaryClass
{
....
}
[AttributeUsage( AttributeTargets.Class | AttributeTargets.Method,
AllowMultiple = true)]
public class CustomClassAttribute : System.Attribute
{
public CustomClassAttribute ( string checkExpression )
{
...
}
}