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


C# IPermission.ToString方法代码示例

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


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

示例1: 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

示例2: Union

        /// <include file='doc\MessageQueuePermission.uex' path='docs/doc[@for="MessageQueuePermission.Union"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override IPermission Union(IPermission target)
        {
            if (target == null)
                return this.Copy();

            if (!(target is MessageQueuePermission))
                throw new ArgumentException(Res.GetString(Res.InvalidParameter, "target", target.ToString()));

            MessageQueuePermission targetQueuePermission = (MessageQueuePermission)target;
            MessageQueuePermission newPermission = new MessageQueuePermission();
            if (this.IsUnrestricted() || targetQueuePermission.IsUnrestricted())
            {
                newPermission.isUnrestricted = true;
                return newPermission;
            }

            Hashtable newFormatNames = new Hashtable(GetComparer());
            this.ResolveFormatNames();
            targetQueuePermission.ResolveFormatNames();

            IDictionaryEnumerator formatNamesEnumerator = this.resolvedFormatNames.GetEnumerator();
            IDictionaryEnumerator targetFormatNamesEnumerator = targetQueuePermission.resolvedFormatNames.GetEnumerator();
            while (formatNamesEnumerator.MoveNext())
                newFormatNames[(string)formatNamesEnumerator.Key] = formatNamesEnumerator.Value;

            while (targetFormatNamesEnumerator.MoveNext())
            {
                if (!newFormatNames.ContainsKey(targetFormatNamesEnumerator.Key))
                    newFormatNames[targetFormatNamesEnumerator.Key] = targetFormatNamesEnumerator.Value;
                else
                {
                    MessageQueuePermissionAccess currentAccess = (MessageQueuePermissionAccess)newFormatNames[targetFormatNamesEnumerator.Key];
                    newFormatNames[targetFormatNamesEnumerator.Key] = currentAccess | (MessageQueuePermissionAccess)targetFormatNamesEnumerator.Value;
                }
            }

            newPermission.resolvedFormatNames = newFormatNames;
            return newPermission;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:43,代码来源:MessageQueuePermission.cs

示例3: IsSubsetOf

        /// <include file='doc\MessageQueuePermission.uex' path='docs/doc[@for="MessageQueuePermission.IsSubsetOf"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override bool IsSubsetOf(IPermission target)
        {
            if (target == null)
                return false;

            if (!(target is MessageQueuePermission))
                throw new ArgumentException(Res.GetString(Res.InvalidParameter, "target", target.ToString()));

            MessageQueuePermission targetQueuePermission = (MessageQueuePermission)target;
            if (targetQueuePermission.IsUnrestricted())
                return true;
            else if (this.IsUnrestricted())
                return false;

            this.ResolveFormatNames();
            targetQueuePermission.ResolveFormatNames();

            //If one of the tables is empty the subset cannot be resolved reliably, should assume
            //then that they are not subset of each other.
            if ((this.resolvedFormatNames.Count == 0 && targetQueuePermission.resolvedFormatNames.Count != 0) ||
                (this.resolvedFormatNames.Count != 0 && targetQueuePermission.resolvedFormatNames.Count == 0))
                return false;

            //If the target table contains a wild card, all the current formatName access need to be
            //a subset of the target.                      
            IDictionaryEnumerator formatNamesEnumerator;
            if (targetQueuePermission.resolvedFormatNames.ContainsKey(Any))
            {
                MessageQueuePermissionAccess targetAccess = (MessageQueuePermissionAccess)targetQueuePermission.resolvedFormatNames[Any];
                formatNamesEnumerator = this.resolvedFormatNames.GetEnumerator();
                while (formatNamesEnumerator.MoveNext())
                {
                    MessageQueuePermissionAccess currentAccess = (MessageQueuePermissionAccess)formatNamesEnumerator.Value;
                    if ((currentAccess & targetAccess) != currentAccess)
                        return false;
                }

                return true;
            }

            //If the current table contains a wild card it can be treated as any other format name.
            formatNamesEnumerator = this.resolvedFormatNames.GetEnumerator();
            while (formatNamesEnumerator.MoveNext())
            {
                string currentFormatName = (string)formatNamesEnumerator.Key;
                if (!targetQueuePermission.resolvedFormatNames.ContainsKey(currentFormatName))
                    return false;
                else
                {
                    MessageQueuePermissionAccess currentAccess = (MessageQueuePermissionAccess)formatNamesEnumerator.Value;
                    MessageQueuePermissionAccess targetAccess = (MessageQueuePermissionAccess)targetQueuePermission.resolvedFormatNames[currentFormatName];
                    if ((currentAccess & targetAccess) != currentAccess)
                        return false;
                }
            }

            return true;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:62,代码来源:MessageQueuePermission.cs

示例4: Intersect

        /// <include file='doc\MessageQueuePermission.uex' path='docs/doc[@for="MessageQueuePermission.Intersect"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
                return null;

            if (!(target is MessageQueuePermission))
                throw new ArgumentException(Res.GetString(Res.InvalidParameter, "target", target.ToString()));

            MessageQueuePermission targetQueuePermission = (MessageQueuePermission)target;
            if (this.IsUnrestricted())
                return targetQueuePermission.Copy();

            if (targetQueuePermission.IsUnrestricted())
                return this.Copy();

            this.ResolveFormatNames();
            targetQueuePermission.ResolveFormatNames();
            MessageQueuePermission newPermission = new MessageQueuePermission();
            Hashtable newFormatNames = new Hashtable(GetComparer());
            newPermission.resolvedFormatNames = newFormatNames;
            IDictionaryEnumerator formatNamesEnumerator;
            Hashtable formatNamesTable;
            if (this.resolvedFormatNames.Count < targetQueuePermission.resolvedFormatNames.Count)
            {
                formatNamesEnumerator = this.resolvedFormatNames.GetEnumerator();
                formatNamesTable = targetQueuePermission.resolvedFormatNames;
            }
            else
            {
                formatNamesEnumerator = targetQueuePermission.resolvedFormatNames.GetEnumerator();
                formatNamesTable = this.resolvedFormatNames;
            }

            while (formatNamesEnumerator.MoveNext())
            {
                if (formatNamesTable.ContainsKey(formatNamesEnumerator.Key))
                {
                    string currentFormatName = (string)formatNamesEnumerator.Key;
                    MessageQueuePermissionAccess currentAccess = (MessageQueuePermissionAccess)formatNamesEnumerator.Value;
                    MessageQueuePermissionAccess targetAccess = (MessageQueuePermissionAccess)formatNamesTable[currentFormatName];
                    newFormatNames.Add(currentFormatName, currentAccess & targetAccess);
                }
            }

            return newPermission;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:50,代码来源:MessageQueuePermission.cs

示例5: IsSubsetOf

        /// <devdoc>
        /// <para>Compares two System.Net.AspNetHostingPermission instances.</para>
        /// </devdoc>
        public override bool IsSubsetOf(IPermission target) {
            if (target == null) {
                return _level == AspNetHostingPermissionLevel.None;
            }

            if (target.GetType() != typeof(AspNetHostingPermission)) {
                throw new ArgumentException(SR.GetString(SR.InvalidArgument, target == null ? "null" : target.ToString(), "target"));
            }

            AspNetHostingPermission other = (AspNetHostingPermission) target;
            return Level <= other.Level;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:15,代码来源:aspnethostingpermission.cs

示例6: Intersect

        /// <devdoc>
        /// <para>Returns the logical intersection between two System.Net.AspNetHostingPermission instances.</para>
        /// </devdoc>
        public override IPermission Intersect(IPermission target) {
            if (target == null) {
                return null;
            }

            if (target.GetType() !=  typeof(AspNetHostingPermission)) {
                throw new ArgumentException(SR.GetString(SR.InvalidArgument, target == null ? "null" : target.ToString(), "target"));
            }

            AspNetHostingPermission other = (AspNetHostingPermission) target;
            if (Level <= other.Level) {
                return new AspNetHostingPermission(Level);
            }
            else {
                return new AspNetHostingPermission(other.Level);
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:aspnethostingpermission.cs

示例7: Union

 public override IPermission Union(IPermission target)
 {
     if (target == null)
         return this.Copy();
     else if (!(target is MessageQueuePermission))
     {
         throw new ArgumentException(Res.GetString("InvalidParameter", (object)"target", (object)target.ToString()));
     }
     else
     {
         MessageQueuePermission messageQueuePermission1 = (MessageQueuePermission)target;
         MessageQueuePermission messageQueuePermission2 = new MessageQueuePermission();
         if (this.IsUnrestricted() || messageQueuePermission1.IsUnrestricted())
         {
             messageQueuePermission2.isUnrestricted = true;
             return (IPermission)messageQueuePermission2;
         }
         else
         {
             Hashtable hashtable = new Hashtable(MessageQueuePermission.GetComparer());
             this.ResolveFormatNames();
             messageQueuePermission1.ResolveFormatNames();
             IDictionaryEnumerator enumerator1 = this.resolvedFormatNames.GetEnumerator();
             IDictionaryEnumerator enumerator2 = messageQueuePermission1.resolvedFormatNames.GetEnumerator();
             while (enumerator1.MoveNext())
                 hashtable[(object)(string)enumerator1.Key] = enumerator1.Value;
             while (enumerator2.MoveNext())
             {
                 if (!hashtable.ContainsKey(enumerator2.Key))
                 {
                     hashtable[enumerator2.Key] = enumerator2.Value;
                 }
                 else
                 {
                     MessageQueuePermissionAccess permissionAccess = (MessageQueuePermissionAccess)hashtable[enumerator2.Key];
                     hashtable[enumerator2.Key] = (object)(permissionAccess | (MessageQueuePermissionAccess)enumerator2.Value);
                 }
             }
             messageQueuePermission2.resolvedFormatNames = hashtable;
             return (IPermission)messageQueuePermission2;
         }
     }
 }
开发者ID:agglerithm,项目名称:ClrIntegration,代码行数:43,代码来源:MessageQueuePermission.cs

示例8: IsSubsetOf

 public override bool IsSubsetOf(IPermission target)
 {
     if (target == null)
         return false;
     if (!(target is MessageQueuePermission))
     {
         throw new ArgumentException("InvalidParameter: target" + target.ToString());
     }
     {
         MessageQueuePermission messageQueuePermission = (MessageQueuePermission)target;
         if (messageQueuePermission.IsUnrestricted())
             return true;
         else if (this.IsUnrestricted())
         {
             return false;
         }
         else
         {
             this.ResolveFormatNames();
             messageQueuePermission.ResolveFormatNames();
             if (this.resolvedFormatNames.Count == 0 && messageQueuePermission.resolvedFormatNames.Count != 0 || this.resolvedFormatNames.Count != 0 && messageQueuePermission.resolvedFormatNames.Count == 0)
                 return false;
             else if (messageQueuePermission.resolvedFormatNames.ContainsKey((object)"*"))
             {
                 MessageQueuePermissionAccess permissionAccess1 = (MessageQueuePermissionAccess)messageQueuePermission.resolvedFormatNames[(object)"*"];
                 IDictionaryEnumerator enumerator = this.resolvedFormatNames.GetEnumerator();
                 while (enumerator.MoveNext())
                 {
                     MessageQueuePermissionAccess permissionAccess2 = (MessageQueuePermissionAccess)enumerator.Value;
                     if ((permissionAccess2 & permissionAccess1) != permissionAccess2)
                         return false;
                 }
                 return true;
             }
             else
             {
                 IDictionaryEnumerator enumerator = this.resolvedFormatNames.GetEnumerator();
                 while (enumerator.MoveNext())
                 {
                     string str = (string)enumerator.Key;
                     if (!messageQueuePermission.resolvedFormatNames.ContainsKey((object)str))
                     {
                         return false;
                     }
                     else
                     {
                         MessageQueuePermissionAccess permissionAccess1 = (MessageQueuePermissionAccess)enumerator.Value;
                         MessageQueuePermissionAccess permissionAccess2 = (MessageQueuePermissionAccess)messageQueuePermission.resolvedFormatNames[(object)str];
                         if ((permissionAccess1 & permissionAccess2) != permissionAccess1)
                             return false;
                     }
                 }
                 return true;
             }
         }
     }
 }
开发者ID:agglerithm,项目名称:ClrIntegration,代码行数:57,代码来源:MessageQueuePermission.cs

示例9: IsSubsetOf

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


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