Class AssetReference
An asset reference.
[DataContract("aref")]
[DataStyle(DataStyle.Compact)]
[DataSerializer(typeof(AssetReferenceDataSerializer))]
public sealed class AssetReference : IReference, IEquatable<AssetReference>
- Inheritance
-
AssetReference
- Implements
- Extension Methods
Constructors
AssetReference(AssetId, UFile)
Initializes a new instance of the AssetReference class.
public AssetReference(AssetId id, UFile location)
Parameters
idAssetIdThe unique identifier of the asset.
locationUFileThe location.
Properties
Id
Gets or sets the unique identifier of the reference asset.
[DataMember(10)]
public AssetId Id { get; init; }
Property Value
- AssetId
The unique identifier of the reference asset..
Location
Gets or sets the location of the asset.
[DataMember(20)]
public string Location { get; init; }
Property Value
- string
The location.
Methods
Equals(AssetReference)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(AssetReference other)
Parameters
otherAssetReferenceAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
New(AssetId, UFile)
Tries to parse an asset reference in the format "GUID:Location".
public static AssetReference New(AssetId id, UFile location)
Parameters
idAssetIdThe identifier.
locationUFileThe location.
Returns
- AssetReference
trueif parsing was successful,falseotherwise.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryParse(string, out AssetId, out UFile)
Tries to parse an asset reference in the format "[GUID/]GUID:Location". The first GUID is optional and is used to store the ID of the reference.
public static bool TryParse(string assetReferenceText, out AssetId id, out UFile location)
Parameters
assetReferenceTextstringThe asset reference.
idAssetIdThe unique identifier of asset pointed by this reference.
locationUFileThe location.
Returns
- bool
trueif parsing was successful,falseotherwise.
Exceptions
- ArgumentNullException
assetReferenceText
TryParse(string, out AssetReference)
Tries to parse an asset reference in the format "GUID:Location".
public static bool TryParse(string assetReferenceText, out AssetReference assetReference)
Parameters
assetReferenceTextstringThe asset reference.
assetReferenceAssetReferenceThe reference.
Returns
- bool
trueif parsing was successful,falseotherwise.
Operators
operator ==(AssetReference, AssetReference)
Implements the ==.
public static bool operator ==(AssetReference left, AssetReference right)
Parameters
leftAssetReferenceThe left.
rightAssetReferenceThe right.
Returns
- bool
The result of the operator.
operator !=(AssetReference, AssetReference)
Implements the !=.
public static bool operator !=(AssetReference left, AssetReference right)
Parameters
leftAssetReferenceThe left.
rightAssetReferenceThe right.
Returns
- bool
The result of the operator.