Your class don't have Conditional
attribute,your method marked with Conditional
Attribute.So you need to get your Method
first,then get the Attribute(s)
var attributes = typeof(Class1)
.GetMethod("MyMethod", BindingFlags.NonPublic | BindingFlags.Static)
.GetCustomAttributes().OfType<ConditionalAttribute>()
.OrderBy(a => a.ConditionString);
foreach (var at in attributes)
{
Console.Write(at.ConditionString);
}