Class Extensions
A collection of useful extension methods that probably should've already existed in the base .NET/Unity APIs.
Inheritance
System.Object
Extensions
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public static class Extensions
Methods
DestroyChildren(Transform)
Call DestroyImmediate () on each direct child of this Transform.
Declaration
public static void DestroyChildren(this Transform parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The parent of the objects to destroy. |
GetName<T>(T)
Converts the current enum value into a string.
Declaration
public static string GetName<T>(this T value)
where T : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The current instance of the enum value. |
Returns
| Type | Description |
|---|---|
| System.String | The enum value converted into a string. |
Type Parameters
| Name | Description |
|---|---|
| T | The enum type. |
ToDateTime(String)
Allows direct conversion of a string which happens to represent a time or date into a DateTime value.
Declaration
public static DateTime ToDateTime(this string dateTimeString)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | dateTimeString | The string to convert |
Returns
| Type | Description |
|---|---|
| DateTime | A new |
ToStandardFormat(DateTime)
Allows direct conversion of a DateTime value to a string that goes from years to seconds in decending order.
Declaration
public static string ToStandardFormat(this DateTime dateTime)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | dateTime | The value to convert. |
Returns
| Type | Description |
|---|---|
| System.String | A new standard format string of the value. |