T
TruongLapVi
Hi everybody,
I have write customize attribute TestAttribute
[AttributeUsage(AttributeTargets.All, Inherited = true)]
public class TestAttribute : Attribute
{
private string name;
public TestAttribute(string name)
{
this.name = name;
}
}
[TestAttribute("Test test")]
public interface TestInterface
{
void function();
}
public class TestClass : TestInterface
{
public void function()...
}
But why TestClass does not inherit TestAttribute from TestInterface ???
Type t = typeof(DerivedClass);
TestAttribute testAttr = (TestAttribute)Attribute.GetCustomAttribute(t,
typeof(TestAttribute));
testAttr alway null. Can anybody help me ?
Thanks.
I have write customize attribute TestAttribute
[AttributeUsage(AttributeTargets.All, Inherited = true)]
public class TestAttribute : Attribute
{
private string name;
public TestAttribute(string name)
{
this.name = name;
}
}
[TestAttribute("Test test")]
public interface TestInterface
{
void function();
}
public class TestClass : TestInterface
{
public void function()...
}
But why TestClass does not inherit TestAttribute from TestInterface ???
Type t = typeof(DerivedClass);
TestAttribute testAttr = (TestAttribute)Attribute.GetCustomAttribute(t,
typeof(TestAttribute));
testAttr alway null. Can anybody help me ?
Thanks.