本文整理汇总了C#中MemberKind类的典型用法代码示例。如果您正苦于以下问题:C# MemberKind类的具体用法?C# MemberKind怎么用?C# MemberKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberKind类属于命名空间,在下文中一共展示了MemberKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToMarkdown
/// <summary>
/// Convert the param XML element to Markdown safely.
/// </summary>
/// <param name="elements">The param XML element list.</param>
/// <param name="paramTypes">The paramater type names.</param>
/// <param name="memberKind">The member kind of the parent element.</param>
/// <returns>The generated Markdown.</returns>
/// <remarks>
/// When the parameter (a.k.a <paramref name="elements"/>) list is empty:
/// <para>If parent element kind is <see cref="MemberKind.Constructor"/> or <see cref="MemberKind.Method"/>, it returns a hint about "no parameters".</para>
/// <para>If parent element kind is not the value mentioned above, it returns an empty string.</para>
/// </remarks>
internal static IEnumerable<string> ToMarkdown(
IEnumerable<XElement> elements,
IEnumerable<string> paramTypes,
MemberKind memberKind)
{
if (!elements.Any())
{
return
memberKind != MemberKind.Constructor &&
memberKind != MemberKind.Method
? Enumerable.Empty<string>()
: new[]
{
"##### Parameters",
$"This {memberKind.ToLowerString()} has no parameters."
};
}
var markdowns = elements
.Zip(paramTypes, (element, type) => new ParamUnit(element, type))
.SelectMany(unit => unit.ToMarkdown());
var table = new[]
{
"| Name | Type | Description |",
"| ---- | ---- | ----------- |"
}
.Concat(markdowns);
return new[]
{
"##### Parameters",
string.Join("\n", table)
};
}
示例2: MemberDoc
public MemberDoc(string name, MemberKind kind) {
ContractUtils.RequiresNotNull(name, "name");
ContractUtils.Requires(kind >= MemberKind.None && kind <= MemberKind.Namespace, "kind");
_name = name;
_kind = kind;
}
示例3: buildFieldDocumentation
void buildFieldDocumentation(FieldInfo field, TypeMemberNode fieldDeclaration) {
var comment = ParserHelper.decodeDocumentation(context.Text, fieldDeclaration.DocumentationOffset,
fieldDeclaration.DocumentationLength);
memberKind = MemberKind.Field;
this.field = field;
node = fieldDeclaration;
appendDocumentation(getIdString(field), comment);
}
示例4: buildTypeDocumentation
void buildTypeDocumentation(TypeInfo type, TypeMemberNode typeDeclaration) {
var comment = ParserHelper.decodeDocumentation(context.Text, typeDeclaration.DocumentationOffset,
typeDeclaration.DocumentationLength);
memberKind = MemberKind.Type;
this.type = type;
node = typeDeclaration;
appendDocumentation(getIdString(type), comment);
}
示例5: buildMethodDocumentation
void buildMethodDocumentation(MethodInfo method, TypeMemberNode methodDeclaration) {
var comment = ParserHelper.decodeDocumentation(context.Text, methodDeclaration.DocumentationOffset,
methodDeclaration.DocumentationLength);
memberKind = MemberKind.Method;
this.method = method;
node = methodDeclaration;
appendDocumentation(getIdString(method), comment);
}
示例6: CompilerGeneratedContainer
protected CompilerGeneratedContainer (TypeContainer parent, MemberName name, Modifiers mod, MemberKind kind)
: base (parent, name, null, kind)
{
Debug.Assert ((mod & Modifiers.AccessibilityMask) != 0);
ModFlags = mod | Modifiers.COMPILER_GENERATED | Modifiers.SEALED;
spec = new TypeSpec (Kind, null, this, null, ModFlags);
}
示例7: TypeContainer
public TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs)
{
this.Kind = kind;
if (name != null)
this.Basename = name.Basename;
defined_names = new Dictionary<string, MemberCore> ();
}
示例8: WriteContractsPerKind
/// <summary>
/// Writes the number of contracts for a given kind.
/// </summary>
/// <param name="kind"></param>
public void WriteContractsPerKind(MemberKind kind) {
int kindCount = 0;
int kindWithContractsCount = 0;
int contractCount = 0;
foreach (var member in MembersInfo) {
if (member.kind != kind) continue;
kindCount++;
if (member.contracts > 0) {
kindWithContractsCount++;
contractCount += member.contracts;
}
}
this.WriteLine("-----");
this.WriteLine("{0}s:", kind);
this.WriteLine("{0} {1}s.", kindCount, kind);
this.WriteLine("{0} have contracts.", kindWithContractsCount);
this.WriteLine("{0} total contracts.", contractCount);
this.WriteLine("{0} contracts on average per {1} with contracts.", ((float)contractCount / (kindWithContractsCount != 0 ? (float)kindWithContractsCount : -1)), kind);
}
示例9: PropertySpec
public PropertySpec (MemberKind kind, TypeSpec declaringType, IMemberDefinition definition, TypeSpec memberType, PropertyInfo info, Modifiers modifiers)
: base (kind, declaringType, definition, modifiers)
{
this.info = info;
this.memberType = memberType;
}
示例10: TypeContainer
protected TypeContainer (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs)
{
this.Kind = kind;
defined_names = new Dictionary<string, MemberCore> ();
}
示例11: ClassOrStruct
public ClassOrStruct (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs, kind)
{
}
示例12: ClassOrStruct
public ClassOrStruct (NamespaceContainer ns, DeclSpace parent,
MemberName name, Attributes attrs, MemberKind kind)
: base (ns, parent, name, attrs, kind)
{
}
示例13: TypeContainer
public TypeContainer (NamespaceContainer ns, DeclSpace parent, MemberName name,
Attributes attrs, MemberKind kind)
: base (ns, parent, name, attrs)
{
if (parent != null && parent.NamespaceEntry != ns)
throw new InternalErrorException ("A nested type should be in the same NamespaceEntry as its enclosing class");
this.Kind = kind;
this.PartialContainer = this;
}
示例14: DefineBuilders
protected void DefineBuilders (MemberKind kind, ParametersCompiled parameters)
{
PropertyBuilder = Parent.TypeBuilder.DefineProperty (
GetFullName (MemberName), PropertyAttributes.None,
#if !BOOTSTRAP_BASIC // Requires trunk version mscorlib
IsStatic ? 0 : CallingConventions.HasThis,
#endif
MemberType.GetMetaInfo (), null, null,
parameters.GetMetaInfo (), null, null);
PropertySpec spec;
if (kind == MemberKind.Indexer)
spec = new IndexerSpec (Parent.Definition, this, MemberType, parameters, PropertyBuilder, ModFlags);
else
spec = new PropertySpec (kind, Parent.Definition, this, MemberType, PropertyBuilder, ModFlags);
if (Get != null) {
spec.Get = Get.Spec;
var method = Get.Spec.GetMetaInfo () as MethodBuilder;
if (method != null) {
PropertyBuilder.SetGetMethod (method);
Parent.MemberCache.AddMember (this, method.Name, Get.Spec);
}
} else {
CheckMissingAccessor (kind, parameters, true);
}
if (Set != null) {
spec.Set = Set.Spec;
var method = Set.Spec.GetMetaInfo () as MethodBuilder;
if (method != null) {
PropertyBuilder.SetSetMethod (method);
Parent.MemberCache.AddMember (this, method.Name, Set.Spec);
}
} else {
CheckMissingAccessor (kind, parameters, false);
}
Parent.MemberCache.AddMember (this, PropertyBuilder.Name, spec);
}
示例15: MethodSpec
public MethodSpec (MemberKind kind, TypeSpec declaringType, IMethodDefinition details, TypeSpec returnType,
AParametersCollection parameters, Modifiers modifiers)
: base (kind, declaringType, details, modifiers)
{
this.parameters = parameters;
this.returnType = returnType;
}