mscorlib(4.0.0.0) API with additions
ApplicationDirectory.cs
2 using System.Security.Util;
3 
5 {
8  [ComVisible(true)]
9  public sealed class ApplicationDirectory : EvidenceBase
10  {
11  private URLString m_appDirectory;
12 
15  public string Directory => m_appDirectory.ToString();
16 
20  public ApplicationDirectory(string name)
21  {
22  if (name == null)
23  {
24  throw new ArgumentNullException("name");
25  }
26  m_appDirectory = new URLString(name);
27  }
28 
29  private ApplicationDirectory(URLString appDirectory)
30  {
31  m_appDirectory = appDirectory;
32  }
33 
38  public override bool Equals(object o)
39  {
40  ApplicationDirectory applicationDirectory = o as ApplicationDirectory;
41  if (applicationDirectory == null)
42  {
43  return false;
44  }
45  return m_appDirectory.Equals(applicationDirectory.m_appDirectory);
46  }
47 
50  public override int GetHashCode()
51  {
52  return m_appDirectory.GetHashCode();
53  }
54 
57  public override EvidenceBase Clone()
58  {
59  return new ApplicationDirectory(m_appDirectory);
60  }
61 
64  public object Copy()
65  {
66  return Clone();
67  }
68 
69  internal SecurityElement ToXml()
70  {
71  SecurityElement securityElement = new SecurityElement("System.Security.Policy.ApplicationDirectory");
72  securityElement.AddAttribute("version", "1");
73  if (m_appDirectory != null)
74  {
75  securityElement.AddChild(new SecurityElement("Directory", m_appDirectory.ToString()));
76  }
77  return securityElement;
78  }
79 
82  public override string ToString()
83  {
84  return ToXml().ToString();
85  }
86  }
87 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Provides the application directory as evidence for policy evaluation. This class cannot be inherited.
string Directory
Gets the path of the application directory.
Definition: __Canon.cs:3
Provides a base class from which all objects to be used as evidence must derive.
Definition: EvidenceBase.cs:12
override bool Equals(object o)
Determines whether instances of the same type of an evidence object are equivalent.
void AddChild(SecurityElement child)
Adds a child element to the XML element.
override string ToString()
Gets a string representation of the state of the T:System.Security.Policy.ApplicationDirectory eviden...
Represents the XML object model for encoding security objects. This class cannot be inherited.
override int GetHashCode()
Gets the hash code of the current application directory.
ApplicationDirectory(string name)
Initializes a new instance of the T:System.Security.Policy.ApplicationDirectory class.
object Copy()
Creates a new copy of the T:System.Security.Policy.ApplicationDirectory.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...
override EvidenceBase Clone()
Creates a new object that is a copy of the current instance.