本文整理汇总了C#中IReference.FullName方法的典型用法代码示例。如果您正苦于以下问题:C# IReference.FullName方法的具体用法?C# IReference.FullName怎么用?C# IReference.FullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReference
的用法示例。
在下文中一共展示了IReference.FullName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiffConstraints
private DifferenceType DiffConstraints(IDifferences differences, IReference target, IEnumerable<IGenericParameter> implGenericParams, IEnumerable<IGenericParameter> contractGenericParams)
{
int beforeCount = differences.Count();
IGenericParameter[] implParams = implGenericParams.ToArray();
IGenericParameter[] contractParams = contractGenericParams.ToArray();
// We shoudn't hit this because the types/members shouldn't be matched up if they have different generic argument lists
if (implParams.Length != contractParams.Length)
return DifferenceType.Changed;
for (int i = 0; i < implParams.Length; i++)
{
IGenericParameter implParam = implParams[i];
IGenericParameter contractParam = contractParams[i];
if (contractParam.Variance != TypeParameterVariance.NonVariant &&
contractParam.Variance != implParam.Variance)
{
differences.AddIncompatibleDifference("CannotChangeVariance",
"Variance on generic parameter '{0}' for '{1}' is '{2}' in the implementation but '{3}' in the contract.",
implParam.FullName(), target.FullName(), implParam.Variance, contractParam.Variance);
}
string implConstraints = string.Join(",", GetConstraints(implParam).OrderBy(s => s));
string contractConstraints = string.Join(",", GetConstraints(contractParam).OrderBy(s => s));
if (!string.Equals(implConstraints, contractConstraints))
{
differences.AddIncompatibleDifference("CannotChangeGenericConstraints",
"Constraints for generic parameter '{0}' for '{1}' is '{2}' in the implementation but '{3}' in the contract.",
implParam.FullName(), target.FullName(), implConstraints, contractConstraints);
}
}
if (differences.Count() != beforeCount)
return DifferenceType.Changed;
return DifferenceType.Unknown;
}
示例2: Exclude
private static bool Exclude(IReference reference, HashSet<string> exclusions, string alternateName = null)
{
string name = reference.FullName();
bool excluded = exclusions.Contains(name);
if (!excluded && alternateName != null)
{
excluded = exclusions.Contains(alternateName);
}
bool exclude = excluded || (reference.Attributes != null
&& reference.Attributes.Any(attribute => attribute.IsEditorBrowseableStateNever()));
if (exclude && !excluded)
{
exclusions.Add(name);
}
return exclude;
}
示例3: CheckAttributeDifferences
//private bool AnySecurityAttributeAdded(IDifferences differences, IReference target, IEnumerable<ISecurityAttribute> attribues1, IEnumerable<ISecurityAttribute> attributes2)
//{
// return AnyAttributeAdded(differences, target, attribues1.SelectMany(a => a.Attributes), attributes2.SelectMany(a => a.Attributes));
//}
private void CheckAttributeDifferences(IDifferences differences, IReference target, IEnumerable<ICustomAttribute> implAttributes, IEnumerable<ICustomAttribute> contractAttributes)
{
AttributesMapping<IEnumerable<ICustomAttribute>> attributeMapping = new AttributesMapping<IEnumerable<ICustomAttribute>>(_settings);
attributeMapping.AddMapping(0, contractAttributes);
attributeMapping.AddMapping(1, implAttributes);
foreach (var group in attributeMapping.Attributes)
{
switch (group.Difference)
{
case DifferenceType.Added:
{
ITypeReference type = group.Representative.Attributes.First().Type;
string attribName = type.FullName();
if (FilterAttribute(attribName))
break;
AttributeAdded(target, attribName);
differences.AddIncompatibleDifference("CannotAddAttribute",
"Attribute '{0}' exists on '{1}' in the implementation but not the contract.",
attribName, target.FullName());
break;
}
case DifferenceType.Changed:
//TODO: Add some more logic to check the two lists of attributes which have the same type.
break;
case DifferenceType.Removed:
{
ITypeReference type = group.Representative.Attributes.First().Type;
string attribName = type.FullName();
if (s_IgnorableAttributes.Contains(attribName))
break;
differences.AddIncompatibleDifference("CannotRemoveAttribute",
"Attribute '{0}' exists on '{1}' in the contract but not the implementation.",
attribName, target.FullName());
break;
}
}
}
}
示例4: AnyAttributeAdded
private bool AnyAttributeAdded(IDifferences differences, IReference target, IEnumerable<ICustomAttribute> implAttributes, IEnumerable<ICustomAttribute> contractAttributes)
{
bool added = false;
AttributesMapping<IEnumerable<ICustomAttribute>> attributeMapping = new AttributesMapping<IEnumerable<ICustomAttribute>>(_settings);
attributeMapping.AddMapping(0, implAttributes);
attributeMapping.AddMapping(1, contractAttributes);
foreach (var group in attributeMapping.Attributes)
{
switch (group.Difference)
{
case DifferenceType.Added:
ITypeReference type = group.Representative.Attributes.First().Type;
string attribName = type.FullName();
if (s_IgnorableAttributes.Contains(attribName))
break;
differences.AddIncompatibleDifference(this,
"Attribute '{0}' exists in the contract but not the implementation.",
attribName, target.FullName());
added = true;
break;
case DifferenceType.Changed:
//TODO: Add some more logic to check the two lists of attributes which have the same type.
break;
case DifferenceType.Removed:
// Removing attributes is OK
break;
}
}
return added;
}