本文整理汇总了C#中ITypeDefinitionMember类的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinitionMember类的具体用法?C# ITypeDefinitionMember怎么用?C# ITypeDefinitionMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITypeDefinitionMember类属于命名空间,在下文中一共展示了ITypeDefinitionMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThinMember
public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility)
: this(declaringType, memberName, returnType, memberType,
includeStatus, memberNode, visibility, SecurityTransparencyStatus.Transparent)
{
}
示例2: MemberGroupHeading
public static string MemberGroupHeading(ITypeDefinitionMember member)
{
if (member == null)
return null;
IMethodDefinition method = member as IMethodDefinition;
if (method != null)
{
if (method.IsConstructor)
return "Constructors";
return "Methods";
}
IFieldDefinition field = member as IFieldDefinition;
if (field != null)
return "Fields";
IPropertyDefinition property = member as IPropertyDefinition;
if (property != null)
return "Properties";
IEventDefinition evnt = member as IEventDefinition;
if (evnt != null)
return "Events";
INestedTypeDefinition nType = member as INestedTypeDefinition;
if (nType != null)
return "Nested Types";
return null;
}
示例3: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
bool isImplOverridable = IsOverridable(impl);
bool isContractOverridable = IsOverridable(contract);
/*
//@todo: Move to a separate rule that's only run in "strict" mode.
if (isImplInhertiable && !isContractInheritiable)
{
// This is separate because it can be noisy and is generally allowed as long as it is reviewed properly.
differences.AddIncompatibleDifference("CannotMakeMemberVirtual",
"Member '{0}' is virtual in the implementation but non-virtual in the contract.",
impl.FullName());
return DifferenceType.Changed;
}
*/
if (isContractOverridable && !isImplOverridable)
{
differences.AddIncompatibleDifference("CannotMakeMemberNonVirtual",
"Member '{0}' is non-virtual in the implementation but is virtual in the contract.",
impl.FullName());
return DifferenceType.Changed;
}
return DifferenceType.Unknown;
}
示例4: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
if (!impl.ContainingTypeDefinition.IsEnum || !contract.ContainingTypeDefinition.IsEnum)
return DifferenceType.Unknown;
IFieldDefinition implField = impl as IFieldDefinition;
IFieldDefinition contractField = contract as IFieldDefinition;
Contract.Assert(implField != null || contractField != null);
string implValue = Convert.ToString(implField.Constant.Value);
string contractValue = Convert.ToString(contractField.Constant.Value);
// Calling the toString method to compare in since we might have the case where one Enum is type a and the other is type b, but they might still have same value.
if (implValue != contractValue)
{
ITypeReference implValType = impl.ContainingTypeDefinition.GetEnumType();
ITypeReference contractValType = contract.ContainingTypeDefinition.GetEnumType();
differences.AddIncompatibleDifference(this,
"Enum value '{0}' is ({1}){2} in the implementation but ({3}){4} in the contract.",
implField.FullName(), implValType.FullName(), implField.Constant.Value,
contractValType.FullName(), contractField.Constant.Value);
return DifferenceType.Changed;
}
return DifferenceType.Unknown;
}
示例5: Include
public virtual bool Include(ITypeDefinitionMember member)
{
if (member == null)
return false;
if (!member.ContainingTypeDefinition.IsVisibleOutsideAssembly())
return false;
switch (member.Visibility)
{
case TypeMemberVisibility.Public:
return true;
case TypeMemberVisibility.Family:
case TypeMemberVisibility.FamilyOrAssembly:
// CCI's version of IsVisibleOutsideAssembly doesn't
// consider protected members as being visible but for
// our purposes which is to write CS files that can
// be compiled we always need the protected members
return true;
}
if (!member.IsVisibleOutsideAssembly())
return false;
return true;
}
示例6: ScriptMember
/// <summary>
/// Creates a new instance of the class.
/// </summary>
/// <param name="container">The containing type.</param>
/// <param name="memberDef">The CCI member definition.</param>
internal ScriptMember(ScriptType container, ITypeDefinitionMember memberDef)
{
if (container == null || memberDef == null)
throw new InvalidOperationException();
_container = container;
_cciMember = memberDef;
}
示例7: IsMemberExternallyVisible2
// this method takes into account the FrameworkInternal annotation
private bool IsMemberExternallyVisible2(ITypeDefinitionMember member)
{
return ((member.Visibility == TypeMemberVisibility.Public ||
member.Visibility == TypeMemberVisibility.Family ||
member.Visibility == TypeMemberVisibility.FamilyOrAssembly ||
m_implModel.IsFrameworkInternal(member)) &&
IsTypeExternallyVisible2(Util.ContainingTypeDefinition(member)));
}
示例8: Include
// How MDIL affects member visibility:
//
// - A member marked [TreatAsPublicSurface] is treated as public regardless of its own visibility or that of its containing type.
//
public override bool Include(ITypeDefinitionMember member)
{
if (member == null)
return false;
//if (member.IsTreatedAsVisibleOutsideAssembly())
// return true;
return base.Include(member);
}
示例9: GetMemberId
public static string GetMemberId(ITypeDefinitionMember member)
{
Contract.Requires(member != null);
Contract.Ensures(Contract.Result<string>() != null);
using (TextWriter writer = new StringWriter())
{
WriteMember(member, writer);
return (writer.ToString());
}
}
示例10: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
bool added = false;
//added |= AnyAttributeAdded(differences, impl, impl.Attributes, contract.Attributes);
//added |= AnyMethodSpecificAttributeAdded(differences, impl as IMethodDefinition, contract as IMethodDefinition);
if (added)
return DifferenceType.Changed;
return DifferenceType.Unknown;
}
示例11: IsOverridable
private bool IsOverridable(ITypeDefinitionMember member)
{
if (!member.IsVirtual())
return false;
// member virtual final is not overridable
if (member.IsSealed())
return false;
// if member type is Effectively sealed and cannot be extended, then the member cannot be inherited
if (member.ContainingTypeDefinition != null && member.ContainingTypeDefinition.IsEffectivelySealed())
return false;
return true;
}
示例12: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
IMethodDefinition implMethod = impl as IMethodDefinition;
IMethodDefinition contractMethod = contract as IMethodDefinition;
if (implMethod == null || contractMethod == null)
return DifferenceType.Unknown;
if (!ParamNamesMatch(differences, implMethod, contractMethod))
return DifferenceType.Changed;
return DifferenceType.Unknown;
}
示例13: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
IMethodDefinition method1 = impl as IMethodDefinition;
IMethodDefinition method2 = contract as IMethodDefinition;
if (method1 == null || method2 == null)
return DifferenceType.Unknown;
if (!ParamModifiersMatch(differences, method1, method2))
return DifferenceType.Changed;
return DifferenceType.Unknown;
}
示例14: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (impl == null || contract == null)
return DifferenceType.Unknown;
if (impl.IsAbstract() && !contract.IsAbstract())
{
differences.AddIncompatibleDifference("CannotMakeMemberAbstract",
"Member '{0}' is abstract in the implementation but is not abstract in the contract.",
impl.FullName());
return DifferenceType.Changed;
}
return DifferenceType.Unknown;
}
示例15: Diff
public override DifferenceType Diff(IDifferences differences, ITypeDefinitionMember impl, ITypeDefinitionMember contract)
{
if (contract != null && impl == null)
{
if (contract.ContainingTypeDefinition.IsInterface)
{
differences.AddIncompatibleDifference(this, "Contract interface member '{0}' is not in the implementation.", contract.FullName());
return DifferenceType.Changed;
}
}
if (impl != null && contract == null)
{
if (impl.ContainingTypeDefinition.IsInterface)
{
differences.AddIncompatibleDifference(this, "Implementation interface member '{0}' is not in the contract.", impl.FullName());
return DifferenceType.Changed;
}
}
return base.Diff(differences, impl, contract);
}