Show / Hide Table of Contents

Class TypeExtensions

Inheritance
System.Object
TypeExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Sys
Assembly: SIPSorcery.dll
Syntax
public static class TypeExtensions

Fields

| Improve this Doc View Source

WhiteSpaceChars

Declaration
public static readonly char[] WhiteSpaceChars
Field Value
Type Description
System.Char[]

Methods

| Improve this Doc View Source

Deconstruct<T>(IList<T>, out T, out T)

Purpose of this extension is to allow deconstruction of a list into a fixed size tuple.

Declaration
public static void Deconstruct<T>(this IList<T> list, out T first, out T second)
Parameters
Type Name Description
System.Collections.Generic.IList<T> list
T first
T second
Type Parameters
Name Description
T
Examples

(var field0, var field1) = "a b c".Split();

| Improve this Doc View Source

Deconstruct<T>(IList<T>, out T, out T, out T)

Purpose of this extension is to allow deconstruction of a list into a fixed size tuple.

Declaration
public static void Deconstruct<T>(this IList<T> list, out T first, out T second, out T third)
Parameters
Type Name Description
System.Collections.Generic.IList<T> list
T first
T second
T third
Type Parameters
Name Description
T
Examples

(var field0, var field1, var field2) = "a b c".Split();

| Improve this Doc View Source

Deconstruct<T>(IList<T>, out T, out T, out T, out T)

Purpose of this extension is to allow deconstruction of a list into a fixed size tuple.

Declaration
public static void Deconstruct<T>(this IList<T> list, out T first, out T second, out T third, out T fourth)
Parameters
Type Name Description
System.Collections.Generic.IList<T> list
T first
T second
T third
T fourth
Type Parameters
Name Description
T
Examples

(var field0, var field1, var field2, var field3) = "a b c d".Split();

| Improve this Doc View Source

Deconstruct<T1, T2>(KeyValuePair<T1, T2>, out T1, out T2)

Declaration
public static void Deconstruct<T1, T2>(this KeyValuePair<T1, T2> tuple, out T1 key, out T2 value)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<T1, T2> tuple
T1 key
T2 value
Type Parameters
Name Description
T1
T2
| Improve this Doc View Source

GetEpoch(DateTime)

Declaration
public static long GetEpoch(this DateTime dateTime)
Parameters
Type Name Description
System.DateTime dateTime
Returns
Type Description
System.Int64
| Improve this Doc View Source

HexStr(Byte[], Int32, Nullable<Char>)

Declaration
public static string HexStr(this byte[] buffer, int length, char? separator = null)
Parameters
Type Name Description
System.Byte[] buffer
System.Int32 length
System.Nullable<System.Char> separator
Returns
Type Description
System.String
| Improve this Doc View Source

HexStr(Byte[], Nullable<Char>)

Declaration
public static string HexStr(this byte[] buffer, char? separator = null)
Parameters
Type Name Description
System.Byte[] buffer
System.Nullable<System.Char> separator
Returns
Type Description
System.String
| Improve this Doc View Source

IsNullOrBlank(String)

Gets a value that indicates whether or not the collection is empty.

Declaration
public static bool IsNullOrBlank(this string s)
Parameters
Type Name Description
System.String s
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsPrivate(IPAddress)

Declaration
public static bool IsPrivate(this IPAddress address)
Parameters
Type Name Description
System.Net.IPAddress address
Returns
Type Description
System.Boolean
| Improve this Doc View Source

NotNullOrBlank(String)

Declaration
public static bool NotNullOrBlank(this string s)
Parameters
Type Name Description
System.String s
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ParseHexStr(String)

Declaration
public static byte[] ParseHexStr(string hexStr)
Parameters
Type Name Description
System.String hexStr
Returns
Type Description
System.Byte[]
| Improve this Doc View Source

Slice(String, Char, Char)

Returns a slice from a string that is delimited by the first instance of a start and end character. The delimiting characters are not included.

"sip:127.0.0.1:5060;connid=1234".slice(':', ';') => "127.0.0.1:5060"
Declaration
public static string Slice(this string s, char startDelimiter, char endDelimeter)
Parameters
Type Name Description
System.String s

The input string to extract the slice from.

System.Char startDelimiter

The character to start the slice from. The first instance of the character found is used.

System.Char endDelimeter

The character to end the slice on. The first instance of the character found is used.

Returns
Type Description
System.String

A slice of the input string or null if the slice is not possible.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX