本文整理汇总了C#中MemberKind类的典型用法代码示例。如果您正苦于以下问题:C# MemberKind类的具体用法?C# MemberKind怎么用?C# MemberKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberKind类属于命名空间,在下文中一共展示了MemberKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
};
}
开发者ID:atifaziz,项目名称:Vsxmd,代码行数:47,代码来源:ParamUnit.cs
示例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;
}
开发者ID:rwalker,项目名称:ironruby,代码行数:7,代码来源:MemberDoc.cs
示例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);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:8,代码来源:DocumentationBuilder.stab.cs
示例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);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:8,代码来源:DocumentationBuilder.stab.cs
示例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);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:8,代码来源:DocumentationBuilder.stab.cs
示例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);
}
开发者ID:rabink,项目名称:mono,代码行数:8,代码来源:anonymous.cs
示例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> ();
}
开发者ID:fvalette,项目名称:mono,代码行数:9,代码来源:class.cs
示例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);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:23,代码来源:DocTracker.cs
示例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;
}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:6,代码来源:property.cs
示例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> ();
}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:6,代码来源:class.cs
示例11: ClassOrStruct
public ClassOrStruct (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs, kind)
{
}
开发者ID:fvalette,项目名称:mono,代码行数:4,代码来源:class.cs
示例12: ClassOrStruct
public ClassOrStruct (NamespaceContainer ns, DeclSpace parent,
MemberName name, Attributes attrs, MemberKind kind)
: base (ns, parent, name, attrs, kind)
{
}
开发者ID:jordanbtucker,项目名称:mono,代码行数:5,代码来源:class.cs
示例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;
}
开发者ID:jordanbtucker,项目名称:mono,代码行数:10,代码来源:class.cs
示例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);
}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:42,代码来源:property.cs
示例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;
}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:7,代码来源:method.cs
示例16: AnonymousMethodStorey
public AnonymousMethodStorey (ExplicitBlock block, TypeDefinition parent, MemberBase host, TypeParameters tparams, string name, MemberKind kind)
: base (parent, MakeMemberName (host, name, parent.Module.CounterAnonymousContainers, tparams, block.StartLocation),
tparams, 0, kind)
{
OriginalSourceBlock = block;
ID = parent.Module.CounterAnonymousContainers++;
}
开发者ID:rabink,项目名称:mono,代码行数:7,代码来源:anonymous.cs
示例17: CoreLookupType
//
// Looks up a type, and aborts if it is not found. This is used
// by predefined types required by the compiler
//
public static TypeSpec CoreLookupType (CompilerContext ctx, string ns_name, string name, MemberKind kind, bool required)
{
return CoreLookupType (ctx, ns_name, name, 0, kind, required);
}
开发者ID:silk,项目名称:monodevelop,代码行数:8,代码来源:typemanager.cs
示例18: TypeDefinition
public TypeDefinition (TypeContainer parent, MemberName name, Attributes attrs, MemberKind kind)
: base (parent, name, attrs, kind)
{
PartialContainer = this;
members = new List<MemberCore> ();
}
开发者ID:fvalette,项目名称:mono,代码行数:6,代码来源:class.cs
示例19: MemberSpec
protected MemberSpec (MemberKind kind, TypeSpec declaringType, IMemberDefinition definition, Modifiers modifiers)
{
this.Kind = kind;
this.declaringType = declaringType;
this.definition = definition;
this.modifiers = modifiers;
state = StateFlags.Obsolete_Undetected | StateFlags.CLSCompliant_Undetected | StateFlags.MissingDependency_Undetected;
}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:9,代码来源:decl.cs
示例20: Resolve
public static TypeSpec Resolve (ModuleContainer module, MemberKind kind, string ns, string name, int arity, Location loc)
{
Namespace type_ns = module.GlobalRootNamespace.GetNamespace (ns, true);
var te = type_ns.LookupType (module.Compiler, name, arity, false, Location.Null);
if (te == null) {
module.Compiler.Report.Error (518, loc, "The predefined type `{0}.{1}' is not defined or imported", ns, name);
return null;
}
var type = te.Type;
if (type.Kind != kind) {
module.Compiler.Report.Error (520, loc, "The predefined type `{0}.{1}' is not declared correctly", ns, name);
return null;
}
return type;
}
开发者ID:telurmasin,项目名称:mono,代码行数:17,代码来源:typemanager.cs
注:本文中的MemberKind类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论