Medium Trust: Update Weak class to not extend WeakReference and avoid demaning inheritancedemand security permission.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-11-03 14:14:00 -07:00
parent 6f0cbd7794
commit e4b664eafe

View File

@@ -1,23 +1,20 @@
using System; using System;
using System.Runtime.Serialization;
namespace Orchard.Caching { namespace Orchard.Caching {
public class Weak<T> : WeakReference { public class Weak<T> {
public Weak(T target) private readonly WeakReference _target;
: base(target) {
public Weak(T target) {
_target = new WeakReference(target);
} }
public Weak(T target, bool trackResurrection) public Weak(T target, bool trackResurrection) {
: base(target, trackResurrection) { _target = new WeakReference(target, trackResurrection);
} }
protected Weak(SerializationInfo info, StreamingContext context) public T Target {
: base(info, context) { get { return (T)_target.Target; }
} set { _target.Target = value; }
public new T Target {
get { return (T)base.Target; }
set { base.Target = value; }
} }
} }
} }