/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
public override bool IsSubsetOf(IPermission target)
{
EnvironmentPermission environmentPermission = this.Cast(target);
if (environmentPermission == null)
{
return(false);
}
if (this.IsUnrestricted())
{
return(environmentPermission.IsUnrestricted());
}
if (environmentPermission.IsUnrestricted())
{
return(true);
}
foreach (object obj in this.readList)
{
string item = (string)obj;
if (!environmentPermission.readList.Contains(item))
{
return(false);
}
}
foreach (object obj2 in this.writeList)
{
string item2 = (string)obj2;
if (!environmentPermission.writeList.Contains(item2))
{
return(false);
}
}
return(true);
}