System.Security.SecurityManager.SecurityManager.Decode C# (CSharp) Method

Decode() static private method

static private Decode ( IntPtr permissions, int length ) : PermissionSet
permissions IntPtr
length int
return PermissionSet
		internal static PermissionSet Decode (IntPtr permissions, int length)
		{
			// Permission sets from the runtime (declarative security) can be cached
			// for performance as they can never change (i.e. they are read-only).
			PermissionSet ps = null;

			lock (_lockObject) {
				if (_declsecCache == null) {
					_declsecCache = new Hashtable ();
				}

				object key = (object) (int) permissions;
				ps = (PermissionSet) _declsecCache [key];
				if (ps == null) {
					// create permissionset and add it to the cache
					byte[] data = new byte [length];
					Marshal.Copy (permissions, data, 0, length);
					ps = Decode (data);
					ps.DeclarativeSecurity = true;
					_declsecCache.Add (key, ps);
				}
			}
			return ps;
		}

Same methods

SecurityManager.SecurityManager::Decode ( byte encodedPermissions ) : PermissionSet