mscorlib(4.0.0.0) API with additions
Url.cs
3 using System.Security.Util;
4 
6 {
9  [ComVisible(true)]
11  {
12  private URLString m_url;
13 
16  public string Value => m_url.ToString();
17 
18  internal Url(string name, bool parsed)
19  {
20  if (name == null)
21  {
22  throw new ArgumentNullException("name");
23  }
24  m_url = new URLString(name, parsed);
25  }
26 
30  public Url(string name)
31  {
32  if (name == null)
33  {
34  throw new ArgumentNullException("name");
35  }
36  m_url = new URLString(name);
37  }
38 
39  private Url(Url url)
40  {
41  m_url = url.m_url;
42  }
43 
44  internal URLString GetURLString()
45  {
46  return m_url;
47  }
48 
53  {
54  return new UrlIdentityPermission(m_url);
55  }
56 
61  public override bool Equals(object o)
62  {
63  return (o as Url)?.m_url.Equals(m_url) ?? false;
64  }
65 
68  public override int GetHashCode()
69  {
70  return m_url.GetHashCode();
71  }
72 
75  public override EvidenceBase Clone()
76  {
77  return new Url(this);
78  }
79 
82  public object Copy()
83  {
84  return Clone();
85  }
86 
87  internal SecurityElement ToXml()
88  {
89  SecurityElement securityElement = new SecurityElement("System.Security.Policy.Url");
90  securityElement.AddAttribute("version", "1");
91  if (m_url != null)
92  {
93  securityElement.AddChild(new SecurityElement("Url", m_url.ToString()));
94  }
95  return securityElement;
96  }
97 
100  public override string ToString()
101  {
102  return ToXml().ToString();
103  }
104 
105  internal object Normalize()
106  {
107  return m_url.NormalizeUrl();
108  }
109  }
110 }
object Copy()
Creates a new copy of the evidence object.
Definition: Url.cs:82
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
override EvidenceBase Clone()
Creates a new object that is a copy of the current instance.
Definition: Url.cs:75
Definition: __Canon.cs:3
IPermission CreateIdentityPermission(Evidence evidence)
Creates an identity permission corresponding to the current instance of the T:System....
Definition: Url.cs:52
Provides the URL from which a code assembly originates as evidence for policy evaluation....
Definition: Url.cs:10
Provides a base class from which all objects to be used as evidence must derive.
Definition: EvidenceBase.cs:12
Defines the method that creates a new identity permission.
void AddChild(SecurityElement child)
Adds a child element to the XML element.
override string ToString()
Returns a string representation of the current T:System.Security.Policy.Url.
Definition: Url.cs:100
Represents the XML object model for encoding security objects. This class cannot be inherited.
override int GetHashCode()
Gets the hash code of the current URL.
Definition: Url.cs:68
Defines methods implemented by permission types.
Definition: IPermission.cs:7
override bool Equals(object o)
Compares the current T:System.Security.Policy.Url evidence object to the specified object for equival...
Definition: Url.cs:61
string Value
Gets the URL from which the code assembly originates.
Definition: Url.cs:16
Defines the identity permission for the URL from which the code originates. This class cannot be inhe...
Defines the set of information that constitutes input to security policy decisions....
Definition: Evidence.cs:17
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
Url(string name)
Initializes a new instance of the T:System.Security.Policy.Url class with the URL from which a code a...
Definition: Url.cs:30
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...