Class TransientReference
A comparable weak reference to an object which will not prevent garbage collection. It will positively compare against similar targeted reference trackers as well as the actual target object.
Inheritance
Implements
Inherited Members
Namespace: GDX.Developer
Syntax
public class TransientReference : WeakReference, ISerializable, IComparable, IComparable<TransientReference>, IComparable<WeakReference>, IEquatable<TransientReference>, IEquatable<WeakReference>
Remarks
There isn't a lot of great use cases for using this sort of thing; System.WeakReference on its own is sufficient in most of the use cases, however this particular arrangement is useful for developer-ish stuff.
Constructors
| Improve this Doc View SourceTransientReference(Object)
Create a TransientReference referencing the target
.
Declaration
public TransientReference(object target)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | The target System.Object to reference. |
TransientReference(Object, Boolean)
Create a TransientReference referencing the target
.
Declaration
public TransientReference(object target, bool trackResurrection)
Parameters
Type | Name | Description |
---|---|---|
System.Object | target | The target System.Object to reference. |
System.Boolean | trackResurrection | Should the object remain tracked after it has been finalized. |
TransientReference(SerializationInfo, StreamingContext)
Create a TransientReference from the info
.
Declaration
protected TransientReference(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | A System.Runtime.Serialization.SerializationInfo representation of a TransientReference. |
System.Runtime.Serialization.StreamingContext | context | Describes the source of the System.Runtime.Serialization.SerializationInfo. |
Methods
| Improve this Doc View SourceCompareTo(TransientReference)
Compare this TransientReference to the target TransientReference.
Declaration
public int CompareTo(TransientReference obj)
Parameters
Type | Name | Description |
---|---|---|
TransientReference | obj | The target TransientReference to compare against. |
Returns
Type | Description |
---|---|
System.Int32 | 1 if the same, 0 otherwise. |
CompareTo(Object)
Compare this TransientReference to the target System.Object.
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The target System.Object to compare against. |
Returns
Type | Description |
---|---|
System.Int32 | 1 if the same, 0 otherwise. |
CompareTo(WeakReference)
Compare this TransientReference to the target System.WeakReference.
Declaration
public int CompareTo(WeakReference obj)
Parameters
Type | Name | Description |
---|---|---|
System.WeakReference | obj | The target System.WeakReference to compare against. |
Returns
Type | Description |
---|---|
System.Int32 | 1 if the same, 0 otherwise. |
Equals(TransientReference)
Does this TransientReference equal the target TransientReference.
Declaration
public bool Equals(TransientReference other)
Parameters
Type | Name | Description |
---|---|---|
TransientReference | other | The target TransientReference to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | true if it is the same, false otherwise. |
Equals(Object)
Does this TransientReference equal the target System.Object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The target System.Object to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | true if it is the same, false otherwise. |
Overrides
Equals(WeakReference)
Does this TransientReference equal the target System.WeakReference.
Declaration
public bool Equals(WeakReference other)
Parameters
Type | Name | Description |
---|---|---|
System.WeakReference | other | The target System.WeakReference to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | true if it is the same, false otherwise. |
GetHashCode()
Return the hashcode of the System.WeakReference.Target.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Returns the System.WeakReference.Target's hash code, or -1 if null. |
Overrides
Operators
| Improve this Doc View SourceEquality(TransientReference, TransientReference)
Compare TransientReferences to see if they are equal.
Declaration
public static bool operator ==(TransientReference left, TransientReference right)
Parameters
Type | Name | Description |
---|---|---|
TransientReference | left | Left-side TransientReference. |
TransientReference | right | Right-side TransientReference. |
Returns
Type | Description |
---|---|
System.Boolean | true/false if they are equal. |
Inequality(TransientReference, TransientReference)
Compare TransientReferences to see if they are not equal.
Declaration
public static bool operator !=(TransientReference left, TransientReference right)
Parameters
Type | Name | Description |
---|---|---|
TransientReference | left | Left-side TransientReference. |
TransientReference | right | Right-side TransientReference. |
Returns
Type | Description |
---|---|
System.Boolean | true/false if they are not equal. |