Class Extensions
Inheritance
Namespace: Emby.Media.Common.Extensions
Assembly: Emby.Media.Model.dll
Syntax
public static class Extensions
Methods
AddIfNotExists<T>(List<T>, T)
Declaration
public static void AddIfNotExists<T>(this List<T> list, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<T> | list | |
| T | item |
Type Parameters
| Name | Description |
|---|---|
| T |
AsRational(Resolution)
Creates a Rational from a Resolution.
Declaration
public static Rational AsRational(this Resolution resolution)
Parameters
| Type | Name | Description |
|---|---|---|
| Resolution | resolution | The resolution. |
Returns
| Type | Description |
|---|---|
| Rational | A Rational. |
Remarks
Will throw when height is zero.
AsResolution(Size)
Creates a Resolution from a Size.
Declaration
public static Resolution AsResolution(this Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Size | size |
Returns
| Type | Description |
|---|---|
| Resolution |
AsResolution(Nullable<Size>)
Creates a Resolution from a Size.
Declaration
public static Resolution? AsResolution(this Size? size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.Drawing.Size> | size | The size. |
Returns
| Type | Description |
|---|---|
| System.Nullable<Resolution> |
Capitalize(String)
Capitalizes the specified string.
Declaration
public static string Capitalize(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to capitalize. |
Returns
| Type | Description |
|---|---|
| System.String | A string. |
GetFirstDword(Guid)
Declaration
public static int GetFirstDword(this Guid guid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid |
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetFriendlyString(Guid)
Gets a shortend (friendly) string that is still supposed to be locally unique.
Declaration
public static string GetFriendlyString(this Guid guid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid | The unique identifier. |
Returns
| Type | Description |
|---|---|
| System.String | A shortend (friendly) string. |
IsNotEmpty(String)
Checks whether the specified string is non-null and non-empty.
Declaration
public static bool IsNotEmpty(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | A boolean. |
Remarks
This is an inverted version of System.String.IsNullOrEmpty(System.String) to be used in Linq expressions.
IsNullOrEmpty(String)
Checks whether the specified string is null or empty.
Declaration
public static bool IsNullOrEmpty(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | A boolean. |
Remarks
This is a 'fluent' version version of System.String.IsNullOrEmpty(System.String) to be used in Linq expressions.
JsonClone<T>(T, IJsonSerializer)
Declaration
public static T JsonClone<T>(this T obj, IJsonSerializer jsonSerializer)
Parameters
| Type | Name | Description |
|---|---|---|
| T | obj | |
| IJsonSerializer | jsonSerializer |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
PrefixWith(String, String)
Adds the specified prefix to a string if the string is non-empty.
Declaration
public static string PrefixWith(this string value, string prefix)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to prefix. |
| System.String | prefix | The prefix. |
Returns
| Type | Description |
|---|---|
| System.String |