mscorlib(4.0.0.0) API with additions
EvidenceBase.cs
1 using System.IO;
5 
7 {
10  [ComVisible(true)]
11  [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)]
12  public abstract class EvidenceBase
13  {
16  protected EvidenceBase()
17  {
18  if (!GetType().IsSerializable)
19  {
20  throw new InvalidOperationException(Environment.GetResourceString("Policy_EvidenceMustBeSerializable"));
21  }
22  }
23 
26  [SecuritySafeCritical]
27  [SecurityPermission(SecurityAction.Assert, SerializationFormatter = true)]
28  [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted = true)]
29  public virtual EvidenceBase Clone()
30  {
31  using (MemoryStream memoryStream = new MemoryStream())
32  {
33  BinaryFormatter binaryFormatter = new BinaryFormatter();
34  binaryFormatter.Serialize(memoryStream, this);
35  memoryStream.Position = 0L;
36  return binaryFormatter.Deserialize(memoryStream) as EvidenceBase;
37  }
38  }
39  }
40 }
Describes a set of security permissions applied to code. This class cannot be inherited.
EvidenceBase()
Initializes a new instance of the T:System.Security.Policy.EvidenceBase class.
Definition: EvidenceBase.cs:16
void Serialize(Stream serializationStream, object graph)
Serializes the object, or graph of objects with the specified top (root), to the given stream.
Definition: __Canon.cs:3
Provides a base class from which all objects to be used as evidence must derive.
Definition: EvidenceBase.cs:12
object Deserialize(Stream serializationStream)
Deserializes the specified stream into an object graph.
Serializes and deserializes an object, or an entire graph of connected objects, in binary format.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
Creates a stream whose backing store is memory.To browse the .NET Framework source code for this type...
Definition: MemoryStream.cs:13
Represents a collection that can contain many different types of permissions.
Specifies that the class can be serialized.
The exception that is thrown when a method call is invalid for the object's current state.
override long Position
Gets or sets the current position within the stream.
virtual EvidenceBase Clone()
Creates a new object that is a complete copy of the current instance.
Definition: EvidenceBase.cs:29