本文整理汇总了C#中Mono.CSharp.AttributeEncoder.EncodeNamedPropertyArgument方法的典型用法代码示例。如果您正苦于以下问题:C# AttributeEncoder.EncodeNamedPropertyArgument方法的具体用法?C# AttributeEncoder.EncodeNamedPropertyArgument怎么用?C# AttributeEncoder.EncodeNamedPropertyArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.AttributeEncoder
的用法示例。
在下文中一共展示了AttributeEncoder.EncodeNamedPropertyArgument方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Emit
public void Emit ()
{
if (RootContext.Target == Target.Module) {
module_target_attrs = new AssemblyAttributesPlaceholder (module, name);
module_target_attrs.CreateType ();
module_target_attrs.DefineType ();
module_target_attrs.Define ();
module.AddCompilerGeneratedClass (module_target_attrs);
} else if (added_modules != null) {
ReadModulesAssemblyAttributes ();
}
module.Emit ();
if (module.HasExtensionMethod) {
var pa = Compiler.PredefinedAttributes.Extension;
if (pa.IsDefined) {
SetCustomAttribute (pa.Constructor, AttributeEncoder.Empty);
}
}
if (!wrap_non_exception_throws_custom) {
PredefinedAttribute pa = Compiler.PredefinedAttributes.RuntimeCompatibility;
if (pa.IsDefined && pa.ResolveBuilder ()) {
var prop = pa.GetProperty ("WrapNonExceptionThrows", TypeManager.bool_type, Location.Null);
if (prop != null) {
AttributeEncoder encoder = new AttributeEncoder (false);
encoder.EncodeNamedPropertyArgument (prop, new BoolLiteral (true, Location.Null));
SetCustomAttribute (pa.Constructor, encoder.ToArray ());
}
}
}
if (declarative_security != null) {
MethodInfo add_permission = typeof (AssemblyBuilder).GetMethod ("AddPermissionRequests", BindingFlags.Instance | BindingFlags.NonPublic);
object builder_instance = Builder;
try {
// Microsoft runtime hacking
if (add_permission == null) {
var assembly_builder = typeof (AssemblyBuilder).Assembly.GetType ("System.Reflection.Emit.AssemblyBuilderData");
add_permission = assembly_builder.GetMethod ("AddPermissionRequests", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo fi = typeof (AssemblyBuilder).GetField ("m_assemblyData", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
builder_instance = fi.GetValue (Builder);
}
var args = new PermissionSet [3];
declarative_security.TryGetValue (SecurityAction.RequestMinimum, out args [0]);
declarative_security.TryGetValue (SecurityAction.RequestOptional, out args [1]);
declarative_security.TryGetValue (SecurityAction.RequestRefuse, out args [2]);
add_permission.Invoke (builder_instance, args);
} catch {
Report.RuntimeMissingSupport (Location.Null, "assembly permission setting");
}
}
CheckReferencesPublicToken ();
SetEntryPoint ();
}