本文整理汇总了C#中MemberModel.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MemberModel.ToString方法的具体用法?C# MemberModel.ToString怎么用?C# MemberModel.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberModel
的用法示例。
在下文中一共展示了MemberModel.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextParameters
public TextParameters(MemberModel member)
{
this.text = member.ToString();
//if(member.Comments!=null)
//this.comments = member.Comments.Split('@');
this.comments = member.Comments;
}
示例2: MemberTreeNode
public MemberTreeNode(MemberModel memberModel, int imageIndex, bool labelPropertiesLikeFunctions)
: base(memberModel.ToString(), imageIndex, imageIndex)
{
if (labelPropertiesLikeFunctions &&
(memberModel.Flags & (FlagType.Setter | FlagType.Getter)) != 0)
{
var paramList = string.Empty;
if (memberModel.Parameters != null)
paramList = string.Join(", ", memberModel.Parameters.Select(p => string.Format("{0}:{1}", p.Name, p.Type)).ToArray());
Label = string.Format("{0} ({1}) : {2}", memberModel.Name, paramList, memberModel.Type);
}
else
{
Label = Text;
}
Model = memberModel;
Tag = memberModel.Name + "@" + memberModel.LineFrom;
}
示例3: MemberDeclaration
static public string MemberDeclaration(MemberModel member, bool preventVisibility)
{
// modifiers
FlagType ft = member.Flags;
Visibility acc = member.Access;
string modifiers = "";
if ((ft & FlagType.Intrinsic) > 0)
{
if ((ft & FlagType.Extern) > 0) modifiers += "extern ";
else modifiers += "intrinsic ";
}
else if (!string.IsNullOrEmpty(member.Namespace)
&& member.Namespace != "internal")
{
if ((ft & FlagType.Interface) == 0)
modifiers = member.Namespace + " ";
}
else if (!preventVisibility)
{
if ((member.Flags & FlagType.Interface) == 0)
{
if ((acc & Visibility.Public) > 0) modifiers += "public ";
// else if ((acc & Visibility.Internal) > 0) modifiers += "internal "; // AS3 default
else if ((acc & Visibility.Protected) > 0) modifiers += "protected ";
else if ((acc & Visibility.Private) > 0) modifiers += "private ";
}
}
if ((ft & FlagType.Final) > 0)
modifiers += "final ";
if ((ft & FlagType.Enum) > 0)
{
return member.ToString();
}
else if ((ft & FlagType.Class) > 0)
{
if ((ft & FlagType.Dynamic) > 0)
modifiers += "dynamic ";
string classType = "class";
if ((member.Flags & FlagType.Interface) > 0) classType = "interface";
else if ((member.Flags & FlagType.Enum) > 0) classType = "enum";
else if ((member.Flags & FlagType.Abstract) > 0) classType = "abstract";
else if ((member.Flags & FlagType.TypeDef) > 0) classType = "typedef";
else if ((member.Flags & FlagType.Struct) > 0) classType = "struct";
else if ((member.Flags & FlagType.Delegate) > 0) classType = "delegate";
return String.Format("{0}{1} {2}", modifiers, classType, member.Type);
}
else if ((ft & FlagType.Enum) == 0)
{
if ((ft & FlagType.Native) > 0)
modifiers += "native ";
if ((ft & FlagType.Static) > 0)
modifiers += "static ";
}
// signature
if ((ft & FlagType.Namespace) > 0)
{
return String.Format("{0}namespace {1}", modifiers, member.Name);
}
else if ((ft & FlagType.Variable) > 0)
{
if ((ft & FlagType.LocalVar) > 0) modifiers = "local ";
if ((ft & FlagType.Constant) > 0)
{
if (member.Value == null)
return String.Format("{0}const {1}", modifiers, member.ToDeclarationString());
else
return String.Format("{0}const {1} = {2}", modifiers, member.ToDeclarationString(), member.Value);
}
else return String.Format("{0}var {1}", modifiers, member.ToDeclarationString());
}
else if ((ft & (FlagType.Getter | FlagType.Setter)) > 0)
return String.Format("{0}property {1}", modifiers, member.ToString());
else if ((ft & FlagType.Delegate) > 0)
return String.Format("{0}delegate {1}", modifiers, member.ToString());
else if ((ft & FlagType.Function) > 0)
return String.Format("{0}function {1}", modifiers, member.ToString());
else if (ft == FlagType.Package)
return String.Format("Package {0}", member.Type);
else if (ft == FlagType.Template)
return String.Format("Template {0}", member.Type);
else if (ft == FlagType.Declaration)
return String.Format("Declaration {0}", member.Type);
else
return String.Format("{0}type {1}", modifiers, member.Type);
}