当前位置: 首页>>代码示例>>C#>>正文


C# IPermission.GetType方法代码示例

本文整理汇总了C#中IPermission.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IPermission.GetType方法的具体用法?C# IPermission.GetType怎么用?C# IPermission.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPermission的用法示例。


在下文中一共展示了IPermission.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreatePermissionElement

 internal static SecurityElement CreatePermissionElement(IPermission perm, string permname)
 {
     SecurityElement element = new SecurityElement("IPermission");
     XMLUtil.AddClassAttribute(element, perm.GetType(), permname);
     element.AddAttribute("version", "1");
     return element;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CodeAccessPermission.cs

示例2: GetTokenIndex

		// IBuiltInPermission is internal but we can test it's values
		// using reflection.
		private int GetTokenIndex (IPermission p)
		{
			Type t = p.GetType ();
			int result = (int) t.InvokeMember ("System.Security.Permissions.IBuiltInPermission.GetTokenIndex", 
				BindingFlags.InvokeMethod | BindingFlags.NonPublic |  BindingFlags.Instance,
				null, p, null);
			return result;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:IBuiltInPermissionTest.cs

示例3: Intersect

        public override IPermission Intersect(IPermission target)
        {
            if (target == null) return null;

            if (target.GetType() != typeof(ConfigurationPermission)) throw ExceptionUtil.ParameterInvalid("target");

            // Create an None permission if either this or other is None
            if (_permissionState == PermissionState.None) return new ConfigurationPermission(PermissionState.None);
            ConfigurationPermission other = (ConfigurationPermission)target;
            return new ConfigurationPermission(other._permissionState);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:11,代码来源:ConfigurationPermission.cs

示例4: Union

        public override IPermission Union(IPermission target)
        {
            if (target == null) return Copy();

            if (target.GetType() != typeof(ConfigurationPermission)) throw ExceptionUtil.ParameterInvalid("target");

            // Create an Unrestricted permission if either this or other is unrestricted
            if (_permissionState == PermissionState.Unrestricted)
                return new ConfigurationPermission(PermissionState.Unrestricted);
            ConfigurationPermission other = (ConfigurationPermission)target;
            return new ConfigurationPermission(other._permissionState);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:12,代码来源:ConfigurationPermission.cs

示例5: GetToken

        public static PermissionToken GetToken(IPermission perm)
        {
            if (perm == null)
                return null;
    
            IBuiltInPermission ibPerm = perm as IBuiltInPermission;

            if (ibPerm != null)
                return s_theTokenFactory.BuiltInGetToken( ibPerm.GetTokenIndex(), perm, null );
            else
                return s_theTokenFactory.GetToken(perm.GetType(), perm);
        }
开发者ID:ArildF,项目名称:masters,代码行数:12,代码来源:permissiontoken.cs

示例6: Implies

    /// <summary>
    /// Checks if the specified permission is "implied" by this object.
    /// <para>
    /// More specifically, this method returns true if:
    ///     * perm's class is the same as this object's class, and
    ///     * perm's name equals.
    /// </para>
    /// </summary>
    /// <param name="perm">The permission to check against.</param>
    /// <param name="ignore_case">
    /// A <see cref="Boolean"/> indicating a case-sensitive or insensitive
    /// comparison(<c>true</c> indicates a case-insensitive comparison.)
    /// </param>
    /// <returns>
    /// <c>true</c> if the specified permission is equal to or implied by this
    /// permission; otherwise, false.
    /// </returns>
    public bool Implies(IPermission perm, bool ignore_case) {
      if (perm == null || perm.GetType() != GetType()) {
        return false;
      }

      if (ignore_case) {
        return
          string.Compare(Name, perm.Name,
            StringComparison.InvariantCultureIgnoreCase) == 0;
      }
      return Name == perm.Name;
    }
开发者ID:joethinh,项目名称:nohros-must,代码行数:29,代码来源:BasicPermission.cs

示例7: Intersect

 public override IPermission Intersect(IPermission target)
 {
     if (target == null)
     {
         return null;
     }
     if (target.GetType() != typeof(ConfigurationPermission))
     {
         throw ExceptionUtil.ParameterInvalid("target");
     }
     if (this._permissionState == PermissionState.None)
     {
         return new ConfigurationPermission(PermissionState.None);
     }
     ConfigurationPermission permission = (ConfigurationPermission) target;
     return new ConfigurationPermission(permission._permissionState);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:ConfigurationPermission.cs

示例8: Intersect

 public override IPermission Intersect(IPermission target)
 {
     if (target == null)
     {
         return null;
     }
     if (base.GetType() != target.GetType())
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
     }
     HostProtectionResource resources = this.m_resources & ((HostProtectionPermission) target).m_resources;
     if (resources == HostProtectionResource.None)
     {
         return null;
     }
     return new HostProtectionPermission(resources);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:HostProtectionPermission.cs

示例9: Intersect

 public override IPermission Intersect(IPermission target)
 {
     if (target == null)
     {
         return null;
     }
     if (target.GetType() != typeof(AspNetHostingPermission))
     {
         throw new ArgumentException(SR.GetString("InvalidArgument", new object[] { (target == null) ? "null" : target.ToString(), "target" }));
     }
     AspNetHostingPermission permission = (AspNetHostingPermission) target;
     if (this.Level <= permission.Level)
     {
         return new AspNetHostingPermission(this.Level);
     }
     return new AspNetHostingPermission(permission.Level);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:AspNetHostingPermission.cs

示例10: Intersect

 public override IPermission Intersect(IPermission target)
 {
     NavigationPermission navigationPermission = target as NavigationPermission;
     if (navigationPermission == null)
     {
         throw new ArgumentException(string.Format("Incorrect permission is passed: '{0}' instead of '{1}'", target.GetType(), base.GetType()));
     }
     NavigationAccessList navigationAccessList = new NavigationAccessList();
     NavigationPermission navigationPermission2 = new NavigationPermission();
     foreach (string current in this.AccessInfo.Items)
     {
         if (navigationPermission.AccessInfo.Items.Contains(current))
         {
             navigationAccessList.Items.Add(current);
         }
     }
     navigationPermission2.AccessInfo = navigationAccessList;
     return navigationPermission2;
 }
开发者ID:LSTANCZYK,项目名称:devexpress_xaf_aurum,代码行数:19,代码来源:NavigationPermission.cs

示例11: IsSubsetOf

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override bool IsSubsetOf(IPermission target) {
            if (target == null) {
                return (IsEmpty);
            }

            if (target.GetType() != this.GetType())
                return false;

            ResourcePermissionBase targetPermission = (ResourcePermissionBase)target;
            if (targetPermission.IsUnrestricted())
                return true;
            else if (this.IsUnrestricted())
                return false;

            return IsContentSubset(this.rootTable, targetPermission.rootTable);

        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:20,代码来源:ResourcePermissionBase.cs

示例12: GetToken

 public static PermissionToken GetToken(IPermission perm)
 {
     if (perm == null)
     {
         return null;
     }
     IBuiltInPermission permission = perm as IBuiltInPermission;
     if (permission != null)
     {
         return s_theTokenFactory.BuiltInGetToken(permission.GetTokenIndex(), perm, null);
     }
     return s_theTokenFactory.GetToken(perm.GetType(), perm);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:PermissionToken.cs

示例13: ThrowInvalidPermission

		internal static void ThrowInvalidPermission (IPermission target, Type expected) 
		{
			string msg = Locale.GetText ("Invalid permission type '{0}', expected type '{1}'.");
			msg = String.Format (msg, target.GetType (), expected);
			throw new ArgumentException (msg, "target");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:6,代码来源:MessageQueuePermission.cs

示例14: Intersect

 public override IPermission Intersect(IPermission target)
 {
     if (target == null)
         return null;
     if(this.GetType() != target.GetType())
         throw new ArgumentException( Environment.GetResourceString("Argument_WrongType", this.GetType().FullName) );
     HostProtectionResource newResources = (HostProtectionResource)((uint)this.m_resources & (uint)((HostProtectionPermission)target).m_resources);
     if(newResources == HostProtectionResource.None)
         return null;
     return new HostProtectionPermission(newResources);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:hostprotectionpermission.cs

示例15: IsSubsetOf

  } //FromXml()

  public override bool IsSubsetOf(IPermission target) 
  {
    if (target == null) return false;
    if (typeof(myperm) != target.GetType()) return false;
    return true;
  } //IsSubsetOf()
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:myperm.cs


注:本文中的IPermission.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。