Class Environment.Scene.Attributes
Class used to add attributes to the scene (model) directly. Each instance of the Attributes class can contains multiple objects, each of which are accessible with a string key (name).
Inheritance
Inherited Members
Namespace: Experior.Core
Assembly: Experior.Core.dll
Syntax
[Serializable]
public class Attributes : IAttribute, IDisposable
Properties
CanSave
Indicates if the attribute can be saved. Will be false if there is no object to serialize.
Declaration
public bool CanSave { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Add(String, Object, Boolean)
Add an object to be serialized and stored together with the active model file in readable XML format
Declaration
public static void Add(string name, object serializableObject, bool overwrite = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Key to store object under |
System.Object | serializableObject | Object to serialize |
System.Boolean | overwrite | 'true' to overwrite any existing attribute stored with |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | |
System.ArgumentNullException |
Contains(String)
Determine whether anything is stored under the specified name
Declaration
public static bool Contains(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to find |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if attribute exists, otherwise 'false' |
Dispose()
Removes this attribute from the serialization pool
Declaration
public void Dispose()
Get<T>(String)
Get the object stored under the specified key
Declaration
public static T Get<T>(string name)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of key |
Returns
Type | Description |
---|---|
T | The object if found, default(T) if not found, and null if T is of wrong type |
Type Parameters
Name | Description |
---|---|
T | Type of object |
Remove(Object)
Remove the specified object from the serialization pool
Declaration
public static bool Remove(object serializableObject)
Parameters
Type | Name | Description |
---|---|---|
System.Object | serializableObject | Object to remove |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if found and removed, otherwise 'false' |
Remove(String)
Remove the specified object from the serialization pool
Declaration
public static bool Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Object to remove |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if found and removed, otherwise 'false' |
TryGet<T>(String, out T)
Get the object stored under the specified key
Declaration
public static bool TryGet<T>(string name, out T obj)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of key |
T | obj | The stored object |
Returns
Type | Description |
---|---|
System.Boolean | 'true' if found and of specified type, otherwise 'false' |
Type Parameters
Name | Description |
---|---|
T | Type of object |