|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Método CodeAccessPermission.IsSubsetOf
Namespace: System.Security
Assembly: mscorlib (em mscorlib.dll)
Parâmetros
- target
- Tipo: System.Security.IPermission
Uma permissão que é a serem testadas para a relação de subconjunto. Essa permissão deve ser do mesmo tipo como a permissão atual.
Valor de retorno
Tipo: System.BooleanImplementações
IPermission.IsSubsetOf(IPermission)| Exceção | Condição |
|---|---|
| ArgumentException |
X.IsSubsetOf (x) retorna true. X.IsSubsetOf (y) retorna o mesmo valor de y.IsSubsetOf (x) se e somente se x e y representam o mesmo conjunto de permissões. If X.IsSubsetOf (y) e y.IsSubsetOf(Z) both return true, X.IsSubsetOf (z) retorna true. X.IsSubsetOf (u) retorna true. X.IsSubsetOf (n) retorna false. N.IsSubsetOf (x) retorna true.
public override bool IsSubsetOf(IPermission target)
{
#if(debug)
Console.WriteLine ("************* Entering IsSubsetOf *********************");
#endif
if (target == null)
{
Console.WriteLine ("IsSubsetOf: target == null");
return false;
}
#if(debug)
Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
#endif
try
{
NameIdPermission operand = ( NameIdPermission)target;
// The following check for unrestricted permission is only included as an example for
// permissions that allow the unrestricted state. It is of no value for this permission.
if (true == operand.m_Unrestricted)
{
return true;
}
else if (true == this.m_Unrestricted)
{
return false;
}
if (this.m_Name != null)
{
if (operand.m_Name == null) return false;
if (this.m_Name == "") return true;
}
if (this.m_Name.Equals (operand.m_Name)) return true;
else
{
// Check for wild card character '*'.
int i = operand.m_Name.LastIndexOf ("*");
if (i > 0)
{
string prefix = operand.m_Name.Substring (0, i);
if (this.m_Name.StartsWith (prefix))
{
return true;
}
}
}
return false;
}
catch (InvalidCastException)
{
throw new ArgumentException (String.Format ("Argument_WrongType", this.GetType ().FullName));
}
}
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.