Click to See Complete Forum and Search --> : Do have this sequence correct?
Zirus Blackheart
March 30th, 2008, 10:07 AM
namespace.object.method.attribute
For insatance if i'm "using System;" namespace its then object.method, the question is to use attributes is it then object.method.attribute?
Ya, <-- n00b so thx for any help hehe :)
nelo
March 30th, 2008, 05:53 PM
What do you mean by attritube? Do you mean an attribute to the class? Is so it is object.attribute. What material are you using to learn?
boudino
March 31st, 2008, 03:00 AM
If you mean the attribute with which the method is annotated (e.g. [OperationContract]), then you have to use reflection to obtain it. Like this:
Type t = Type.GetType("namespace.object"); // assume by object you mean class
MethodInfo mi = t.GetMethod("YourMethodName");
object[] attrs = mi.GetCustomAttributes(false);
// and now, you can iterate over attrs and investigate them
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.