Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 |
|
---|
| 6 | namespace Microsoft.Research.DynamicDataDisplay.Common
|
---|
| 7 | {
|
---|
| 8 | internal sealed class WeakReference<T>
|
---|
| 9 | {
|
---|
| 10 | private readonly WeakReference reference;
|
---|
| 11 |
|
---|
| 12 | public WeakReference(WeakReference reference)
|
---|
| 13 | {
|
---|
| 14 | this.reference = reference;
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public WeakReference(T referencedObject)
|
---|
| 18 | {
|
---|
| 19 | this.reference = new WeakReference(referencedObject);
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public bool IsAlive
|
---|
| 23 | {
|
---|
| 24 | get { return reference.IsAlive; }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | public T Target
|
---|
| 28 | {
|
---|
| 29 | get { return (T)reference.Target; }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.