本文整理汇总了C#中System.CodeDom.CodeTypeMember.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CodeTypeMember.GetType方法的具体用法?C# CodeTypeMember.GetType怎么用?C# CodeTypeMember.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.CodeTypeMember
的用法示例。
在下文中一共展示了CodeTypeMember.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateTypeMember
private void ValidateTypeMember(CodeTypeMember e) {
ValidateCommentStatements(e.Comments);
ValidateCodeDirectives(e.StartDirectives);
ValidateCodeDirectives(e.EndDirectives);
if (e.LinePragma != null) ValidateLinePragmaStart(e.LinePragma);
if (e is CodeMemberEvent) {
ValidateEvent((CodeMemberEvent)e);
}
else if (e is CodeMemberField) {
ValidateField((CodeMemberField)e);
}
else if (e is CodeMemberMethod) {
ValidateMemberMethod((CodeMemberMethod)e);
}
else if (e is CodeMemberProperty) {
ValidateProperty((CodeMemberProperty)e);
}
else if (e is CodeSnippetTypeMember) {
ValidateSnippetMember((CodeSnippetTypeMember)e);
}
else if (e is CodeTypeDeclaration) {
ValidateTypeDeclaration((CodeTypeDeclaration)e);
}
else {
throw new ArgumentException(SR.GetString(SR.InvalidElementType, e.GetType().FullName), "e");
}
}
示例2: CodeTypeMemberExtension
/// <summary>
/// Creates a new instance of CodeTypeMemberExtension class.
/// </summary>
/// <param name="extendObject">An object to be decorated by this instance.</param>
public CodeTypeMemberExtension(CodeTypeMember extendedObject, CodeTypeExtension parent)
: base(extendedObject)
{
if (typeof(CodeMemberField) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Field;
}
else if (typeof(CodeMemberMethod) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Method;
}
else if (typeof(CodeMemberProperty) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Property;
}
else if (typeof(CodeMemberEvent) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Event;
}
else if (typeof(CodeSnippetTypeMember) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Snippet;
}
else if (typeof(CodeConstructor) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.Constructor;
}
else if (typeof(CodeTypeConstructor) == extendedObject.GetType())
{
this.kind = CodeTypeMemberKind.StaticConstructor;
}
this.parent = parent;
}
示例3: Translate
private void Translate(CodeTypeMember member, TypeNode declaringType){
if (member == null) return;
else if (member is CodeMemberEvent) this.Translate((CodeMemberEvent)member, declaringType);
else if (member is CodeMemberField) this.Translate((CodeMemberField)member, declaringType);
else if (member is CodeMemberMethod) this.Translate((CodeMemberMethod)member, declaringType);
else if (member is CodeMemberProperty) this.Translate((CodeMemberProperty)member, declaringType);
else if (member is CodeSnippetTypeMember) this.Translate((CodeSnippetTypeMember)member, declaringType);
else if (member is CodeTypeDeclaration) this.Translate((CodeTypeDeclaration)member, null, declaringType);
else throw new ArgumentException("unknown type member", member.GetType().FullName);
}