本文整理汇总了C#中Mono.Cecil.TypeDefinition.LayoutToText方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.LayoutToText方法的具体用法?C# TypeDefinition.LayoutToText怎么用?C# TypeDefinition.LayoutToText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeDefinition
的用法示例。
在下文中一共展示了TypeDefinition.LayoutToText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoWriteType
private void DoWriteType(string indent, TypeDefinition type)
{
if (type.HasCustomAttributes)
DoAppendCustomAttributes(indent, type.CustomAttributes);
if ((type.Attributes & TypeAttributes.LayoutMask) != 0 || // note that we have to use the 0 literal or the runtime gets confused about which zero enum we're referring to
(type.Attributes & TypeAttributes.StringFormatMask) != 0 ||
type.PackingSize != 0)
m_writer.WriteLine(indent + type.LayoutToText(false));
if (type.HasSecurityDeclarations)
DoAppendSecurity(indent, type.SecurityDeclarations);
if (type.IsSerializable)
m_writer.WriteLine(indent + "[Serializable]");
m_writer.Write(indent);
m_writer.Write("{0}", GetModifiers(type, type.Attributes));
m_writer.Write(DoGetQualifiedTypeName(type, false));
if (type.IsEnum)
{
FieldDefinition field = type.Fields.SingleOrDefault(f => f.Name == "value__");
if (field != null && field.FieldType.FullName != "System.Int32")
{
m_writer.Write(" : ");
m_writer.Write(DoGetQualifiedTypeName(field.FieldType, false));
}
}
else if (type.BaseType != null)
{
m_writer.Write(" : ");
m_writer.Write(DoGetQualifiedTypeName(type.BaseType, false));
}
if (type.HasInterfaces)
{
if (type.BaseType != null)
m_writer.Write(", ");
else
m_writer.Write(" : ");
for (int i = 0; i < type.Interfaces.Count; ++i)
{
m_writer.Write(DoGetQualifiedTypeName(type.Interfaces[i], false));
if (i + 1 < type.Interfaces.Count)
m_writer.Write(", ");
}
}
if (!m_addBraceLine)
m_writer.Write(" {0}", "{");
m_writer.WriteLine();
}