本文整理汇总了C#中Mono.Cecil.TypeReference.IsNamed方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.IsNamed方法的具体用法?C# TypeReference.IsNamed怎么用?C# TypeReference.IsNamed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeReference
的用法示例。
在下文中一共展示了TypeReference.IsNamed方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsGenericType
static bool IsGenericType (TypeReference type, string nspace, string name)
{
if (type.IsNamed (nspace, name))
return true;
var type_spec = type as TypeSpecification;
if (type_spec != null && type_spec.ElementType.IsNamed (nspace, name))
return true;
// handle things like ICollection<T>
GenericInstanceType git = (type as GenericInstanceType);
if (git == null)
return false;
return FindGenericType (git, nspace, name);
}
示例2: IsPrefered
protected override bool IsPrefered (TypeReference type)
{
return type.IsNamed ("System", "StringComparison");
}
示例3: IsSpecificXmlType
static bool IsSpecificXmlType (TypeReference type)
{
if (type.Namespace == "System.Xml") {
string name = type.Name;
return ((name == "XmlDocument") || (name == "XmlNode"));
}
return type.IsNamed ("System.Xml.XPath", "XPathDocument");
}
示例4: AreSameElementTypes
private static bool AreSameElementTypes(TypeReference a, TypeReference b)
{
return a.IsGenericParameter || b.IsGenericParameter || b.IsNamed(a.Namespace, a.Name);
}
示例5: CheckGenericDelegate
private bool CheckGenericDelegate (TypeReference type)
{
if (type.IsNamed ("System", "EventHandler`1"))
return true;
Runner.Report (type, Severity.Medium, Confidence.High, "Generic delegates should use EventHandler<TEventArgs>");
return false;
}
示例6: IsIgnoredSuggestionType
private static bool IsIgnoredSuggestionType(TypeReference type)
{
return (type.IsNamed ("System", "Object") || IsFromNonGenericCollectionNamespace (type.Namespace));
}
示例7: IsPrefered
protected override bool IsPrefered (TypeReference type)
{
return (type.IsNamed ("System", "IFormatProvider") || type.IsNamed ("System.Globalization", "CultureInfo"));
}
示例8: Match
private static bool Match (TypeReference type, string nameSpace, string name)
{
int np = name.IndexOf ('/');
if (np == -1) {
if (type.IsNamed (nameSpace, name))
return true;
} else if (type.IsNested) {
string tname = type.Name;
TypeReference dt = type.DeclaringType;
if ((nameSpace == dt.Namespace) &&
(String.CompareOrdinal (name, 0, dt.Name, 0, np) == 0) &&
(String.CompareOrdinal (name, np + 1, tname, 0, tname.Length) == 0))
return true;
}
return false;
}
示例9: CheckMethod
public override RuleResult CheckMethod (MethodDefinition method)
{
if (!method.HasBody)
return RuleResult.DoesNotApply;
//the rule does not apply to the particular case of ToString()
//that have its own ToStringShouldNotReturnNullRule
if (!method.HasParameters && method.Name == "ToString")
return RuleResult.DoesNotApply;
//only apply to methods returning string, array, or IEnumerable-impl
return_type = method.ReturnType;
string_return_type = return_type.IsNamed ("System", "String");
array_return_type = return_type.IsArray;
ienumerable_return_type = return_type.Implements ("System.Collections", "IEnumerable");
if (!string_return_type && !array_return_type && !ienumerable_return_type)
return RuleResult.DoesNotApply;
return base.CheckMethod (method);
}