Init(args)
Scripting Reference
List of all members | Public Member Functions | Static Public Member Functions | Properties
Sisus.Init.Any< T > Struct Template Reference

Description

Represents a value of type T that can be assigned through Unity's inspector as well as serialized by its serializer.

If T is a service type then this object represents the shared instance of that service.

If a class derives from UnityEngine.Object and implements IValueProvider<T> then Any<T> can wrap an instance of this class and return its IValueProvider<T>.Value when Value is called.

If a class derives from UnityEngine.Object and has a System.ComponentModel.TypeConverter which returns true for System.ComponentModel.TypeConverter.CanConvertTo(T) then Any<T> can wrap an instance of this class and convert its Value to T on-the-fly using the type converter.

Template Parameters
TType of the value that this object wraps.

Can be an interface type, a class type or a value type.

Public Member Functions

bool TryGetValue (out T value)
 Gets the value of the current Any<T> object if it has been assigned a valid underlying value. More...
 
 Any (T value)
 Initializes a new instance of the Any struct with the given underlying value. More...
 
 Any (Object value)
 Initializes a new instance of the Any struct with the given underlying value. More...
 
override bool Equals (object other)
 Determines whether the specified object is equal to the current object. More...
 
bool Equals (T other)
 Determines whether the specified object is equal to the value of the current object. More...
 
bool Equals (Object other)
 Determines whether the specified object is equal to the value of the current object. More...
 
bool Equals (Any< T > other)
 Determines whether the specified object is equal to the current object. More...
 
override string ToString ()
 Returns a string that represents the underlying object. More...
 
override int GetHashCode ()
 Returns the hash code for this Any<T> object. More...
 

Static Public Member Functions

static Any< T > FromValue (T value)
 Creates a new instance of the Any struct with the given underlying value. More...
 
static Any< T > FromObject (Object value)
 Creates a new instance of the Any struct with the given underlying value. More...
 
static implicit operator T (Any< T > instance)
 Defines an implicit conversion of a Any<T> to the T object that it wraps. More...
 
static implicit operator Any< T > (T value)
 Defines an explicit conversion of a T to an Any<T> object. More...
 

Properties

bool HasValue [get]
 Gets a value indicating whether the current Any<T> object has a valid value of its underlying type. More...
 
Value [get]
 Gets the value of the current Any<T> object if it has been assigned a valid underlying value. More...
 
ValueOrDefault [get]
 Gets the value of the current Any<T> object if it has been assigned a valid underlying value; otherwise, the default value of T. More...