Class HasPropertiesBase
- Namespace
- DotTiled
- Assembly
- DotTiled.dll
Interface for objects that have properties attached to them.
public abstract class HasPropertiesBase : IHasProperties
- Inheritance
-
HasPropertiesBase
- Implements
- Derived
- Inherited Members
Methods
GetProperties()
The properties attached to the object.
public abstract IList<IProperty> GetProperties()
Returns
GetProperty<T>(string)
Gets a property of the specified type with the specified name.
public T GetProperty<T>(string name) where T : IProperty
Parameters
name
stringThe name of the property to get.
Returns
- T
The property with the specified name.
Type Parameters
T
The type of the property to get.
Exceptions
- KeyNotFoundException
Thrown when a property with the specified name is not found.
- InvalidCastException
Thrown when a property with the specified name is not of the specified type.
MapPropertiesTo<T>()
Maps all properties in this object to a new instance of the specified type using reflection.
public T MapPropertiesTo<T>() where T : new()
Returns
- T
Type Parameters
T
MapPropertiesTo<T>(Func<T>)
Maps all properties in this object to a new instance of the specified type using reflection.
public T MapPropertiesTo<T>(Func<T> initializer)
Parameters
initializer
Func<T>
Returns
- T
Type Parameters
T
TryGetProperty<T>(string, out T)
Tries to get a property of the specified type with the specified name.
public bool TryGetProperty<T>(string name, out T property) where T : IProperty
Parameters
name
stringThe name of the property to get.
property
TThe property with the specified name, if found.
Returns
- bool
True if a property with the specified name was found; otherwise, false.
Type Parameters
T
The type of the property to get.