0
我想弄清楚有哪些方法來比較Roslyn中的屬性數據。Roslyn檢查類型的屬性
static bool ResolveAttributes(IMethodSymbol methodSymbol)
{
var attributes = methodSymbol.GetAttributes();
return null == attributes.FirstOrDefault(attr => isIDEMessageAttribute(attr, typeof(MyAttributeType)));
}
static bool IsIDEMessageAttribute(AttributeData attribute, Type desiredAttributeType)
{
//How can I check if the attribute is the type of desired?
}
如何檢查屬性是否爲所需的類型?