本文整理汇总了C#中Mono.Cecil.FieldReference.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FieldReference.ToString方法的具体用法?C# FieldReference.ToString怎么用?C# FieldReference.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.FieldReference
的用法示例。
在下文中一共展示了FieldReference.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WeaveDependencyProperty
private void WeaveDependencyProperty(MethodBody staticCtorBody, FieldReference field, PropertyDefinition property)
{
var assembly = property.DeclaringType.Module.Assembly;
var propertyType = assembly.ImportType(Type.GetType(property.PropertyType.FullName));
var getTypeFromHandle = assembly.ImportMethod(typeof(Type).GetMethod("GetTypeFromHandle"));
var register = assembly.ImportMethod(typeof(DependencyProperty).GetMethod("Register", new[] { typeof(string), typeof(Type), typeof(Type) }));
// ignore previously weaved DPs
if (staticCtorBody.Instructions.Any(i => i.Operand != null && i.Operand.ToString() == field.ToString()))
{
return;
}
var ret = staticCtorBody.Instructions.Last();
if (ret.OpCode != OpCodes.Ret)
throw new InvalidOperationException("The last instruction should be OpCode.Ret");
HasChanges = true;
var proc = staticCtorBody.GetILProcessor();
proc.InsertBefore(ret, proc.Create(OpCodes.Ldstr, property.Name));
proc.InsertBefore(ret, proc.Create(OpCodes.Ldtoken, propertyType));
proc.InsertBefore(ret, proc.Create(OpCodes.Call, getTypeFromHandle));
proc.InsertBefore(ret, proc.Create(OpCodes.Ldtoken, property.DeclaringType));
proc.InsertBefore(ret, proc.Create(OpCodes.Call, getTypeFromHandle));
proc.InsertBefore(ret, proc.Create(OpCodes.Call, register));
proc.InsertBefore(ret, proc.Create(OpCodes.Stsfld, field));
}
示例2: method_6
internal BfField method_6(FieldReference fieldReference_0)
{
BfAssembly bfAssembly;
BfField result;
if (fieldReference_0.DeclaringType.Scope is AssemblyNameReference)
{
bfAssembly = this.dictionary_0[((AssemblyNameReference)fieldReference_0.DeclaringType.Scope).FullName];
}
else
{
if (!(fieldReference_0.DeclaringType.Scope is ModuleDefinition))
{
Logger.LogWarning("GetBfField1", "Couldn't find assembly for field: " + fieldReference_0.ToString());
result = null;
return result;
}
bfAssembly = this.dictionary_0[((ModuleDefinition)fieldReference_0.DeclaringType.Scope).Assembly.Name.FullName];
}
string key = BfCache.smethod_2(fieldReference_0.DeclaringType);
BfType bfType;
bfAssembly.method_4().TryGetValue(key, out bfType);
if (bfType == null)
{
Logger.LogWarning("GetBfField2", "Couldn't find type for field: " + fieldReference_0.ToString());
result = null;
}
else
{
foreach (BfField bfField in ((IEnumerable<BfField>)bfType.Fields))
{
BfField bfField;
if (fieldReference_0.Name == bfField.Name)
{
result = bfField;
return result;
}
}
foreach (FieldDefinition fieldDefinition in bfType.method_2().Fields)
{
if (fieldDefinition.Name == fieldReference_0.Name)
{
BfField bfField = new BfField(this, fieldDefinition, bfType);
this.fieldCollection_0.method_1(bfField);
bfType.Fields.method_1(bfField);
result = bfField;
return result;
}
}
Logger.LogWarning("GetBfField3", "Couldn't find field " + fieldReference_0.ToString() + " in type: " + bfType.FullName);
result = null;
}
return result;
}
示例3: ImportFieldReference
public FieldReference ImportFieldReference(FieldReference field, ImportContext context)
{
if (field.DeclaringType.Module == m_module)
return field;
ImportCache ();
FieldReference f = (FieldReference) m_memberRefCache [field.ToString ()];
if (f != null)
return f;
f = new FieldReference (
field.Name,
ImportTypeReference (field.DeclaringType, context),
ImportTypeReference (field.FieldType, context));
m_module.MemberReferences.Add (f);
m_memberRefCache [field.ToString ()] = f;
return f;
}