本文整理汇总了VB.NET中System.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity方法的典型用法代码示例。如果您正苦于以下问题:VB.NET MethodBuilder.AddDeclarativeSecurity方法的具体用法?VB.NET MethodBuilder.AddDeclarativeSecurity怎么用?VB.NET MethodBuilder.AddDeclarativeSecurity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.MethodBuilder
的用法示例。
在下文中一共展示了MethodBuilder.AddDeclarativeSecurity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: GetType
' myModBuilder is an instance of ModuleBuilder.
' Note that for the use of PermissionSet and SecurityAction,
' the namespaces System.Security and System.Security.Permissions
' should be included.
Dim myTypeBuilder As TypeBuilder = myModBuilder.DefineType("MyType", _
TypeAttributes.Public)
Dim myMethod1 As MethodBuilder = myTypeBuilder.DefineMethod("MyMethod", _
MethodAttributes.Public, _
GetType(Integer), _
New Type() {GetType(Integer), GetType(Integer)})
Dim myMethodPermissions As New PermissionSet(PermissionState.Unrestricted)
myMethod1.AddDeclarativeSecurity(SecurityAction.Demand, myMethodPermissions)