本文整理汇总了C#中ICodeWriter.WriteTypeEnd方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeWriter.WriteTypeEnd方法的具体用法?C# ICodeWriter.WriteTypeEnd怎么用?C# ICodeWriter.WriteTypeEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeWriter
的用法示例。
在下文中一共展示了ICodeWriter.WriteTypeEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertIType
//.........这里部分代码省略.........
codeWriter.WriteBeforeConstructors();
}
if (mode == ConvertingMode.Definition)
{
codeWriter.DisableWrite(true);
if (!processGenericMethodsOnly)
{
// pre process step to get all used undefined structures
foreach (var ctor in IlReader.Constructors(type, codeWriter))
{
codeWriter.WriteConstructorStart(ctor, genericTypeContext);
foreach (var ilCode in ilReader.OpCodes(type.IsGenericType ? ctor.GetMethodDefinition() : ctor, genericTypeContext))
{
codeWriter.Write(ilCode);
}
codeWriter.WriteConstructorEnd(ctor, genericTypeContext);
}
}
codeWriter.DisableWrite(false);
// Actual Write
codeWriter.WriteRequiredTypesForBody();
codeWriter.WriteStoredText();
}
if (mode == ConvertingMode.Declaration)
{
codeWriter.WriteAfterConstructors();
codeWriter.WriteBeforeMethods();
}
if (mode == ConvertingMode.Definition)
{
codeWriter.DisableWrite(true);
// pre process step to get all used undefined structures
foreach (
var method in
IlReader.Methods(type, codeWriter, true).Select(m => MethodBodyBank.GetMethodWithCustomBodyOrDefault(m, codeWriter)))
{
if (!method.IsGenericMethodDefinition && !processGenericMethodsOnly)
{
var genericMethodContext = method.IsGenericMethod
? MetadataGenericContext.Create(typeDefinition, typeSpecialization, method.GetMethodDefinition(), method)
: genericTypeContext;
codeWriter.WriteMethodStart(method, genericMethodContext);
foreach (var ilCode in ilReader.OpCodes(type.IsGenericType ? method.GetMethodDefinition() : method, genericMethodContext))
{
codeWriter.Write(ilCode);
}
codeWriter.WriteMethodEnd(method, genericMethodContext);
}
if (method.IsGenericMethodDefinition || method.IsGenericMethod)
{
// write all specializations of a method
if (genericMethodSpecializatons != null)
{
var methodDefinition = method.GetMethodDefinition();
foreach (
var methodSpec in
genericMethodSpecializatons.Where(
methodSpec => methodSpec.IsMatchingGeneric(methodDefinition) && (!methodSpec.Equals(method) || processGenericMethodsOnly)))
{
var genericMethodContext = MetadataGenericContext.Create(typeDefinition, typeSpecialization, method, methodSpec);
codeWriter.WriteMethodStart(methodSpec, genericMethodContext);
foreach (var ilCode in ilReader.OpCodes(methodDefinition ?? method, genericMethodContext))
{
codeWriter.Write(ilCode);
}
codeWriter.WriteMethodEnd(methodSpec, genericMethodContext);
}
}
}
}
codeWriter.DisableWrite(false);
// Actual Write
codeWriter.WriteRequiredTypesForBody();
codeWriter.WriteStoredText();
}
if (mode == ConvertingMode.Declaration)
{
codeWriter.WriteAfterMethods();
codeWriter.WriteTypeEnd(type);
}
}