Skip to content

Extensions

Tomáš Bouda edited this page Nov 22, 2017 · 1 revision

🔴 Type Extensions.Char.CharExtensions

Char related extension methods


🔹 Method Extensions.Char.CharExtensions.ToUpper(System.Char)

Shortcut for ToUpper

Param Description
ch

Returns:


🔹 Method Extensions.Char.CharExtensions.ToLower(System.Char)

Shortcut for ToLower

Param Description
ch

Returns:


🔴 Type Extensions.Common.CommonExtensions

CommonExtensions


🔹 Method Extensions.Common.CommonExtensions.OneOf1(System.Random,0[])

Returns random element from given params collection

Type Param Description
T
Param Description
rnd
things

Returns:


🔹 Method Extensions.Common.CommonExtensions.Match(System.String,System.String)

Indicates whether the regular expression specified by pattern finds a match in a specified input String .

Param Description
value
pattern

Returns: true if there is a match


🔹 Method Extensions.Common.CommonExtensions.XmlSerialize1(0)

Serializes an object of type T in to an XML string

Type Param Description
T Any class type
Param Description
obj Object to serialize

Returns: A string that represents XML, empty otherwise


🔹 Method Extensions.Common.CommonExtensions.XmlDeserialize``1(System.String)

Deserializes an xml string into an object of Type T

Type Param Description
T Any class type
Param Description
xml XML as string to deserialize from

Returns: A new object of type T if successful, null if failed


🔹 Method Extensions.Common.CommonExtensions.GetDefaultValue1(System.Nullable{0})

Returns default value of given object

Type Param Description
T
Param Description
source

Returns:


🔹 Method Extensions.Common.CommonExtensions.ToCurrency(System.Double,System.String)

Returns given Decimal value formated as currency

Param Description
value
cultureName

Returns:


🔹 Method Extensions.Common.CommonExtensions.IsNullOrEmpty1(0)

Shortcut for IsNullOrWhiteSpace

Type Param Description
T
Param Description
obj

Returns:


🔹 Method Extensions.Common.CommonExtensions.DeepClone1(0)

Makes a copy from the object. Doesn't copy the reference memory, only data.

Type Param Description
T Type of the return object.
Param Description
item Object to be copied.

Returns: Returns the copied object.


🔹 Method Extensions.Common.CommonExtensions.Clamp1(0,0,0)

Limit a value to a certain range. When the value is smaller/bigger than the range, snap it to the range border.

Type Param Description
T The type of the value to limit.
Param Description
source The source for this extension method.
start The start of the interval, included in the interval.
end The end of the interval, included in the interval.

🔹 Method Extensions.Common.CommonExtensions.IsNull(System.Object)

object == null

Param Description
object

Returns:


🔹 Method Extensions.Common.CommonExtensions.IsDirectory(System.String)

Returns true if given string is path to a directory

Param Description
path

Returns:


🔹 Method Extensions.Common.CommonExtensions.IsFile(System.String)

Returns true if given string is path to a file

Param Description
path

Returns:


🔴 Type Extensions.Data.DataTableExtensions

DataTable related extension methods


🔴 Type Extensions.DateAndTime.DateTimeExtensions

DateTime related extension methods http://extensionoverflow.codeplex.com/SourceControl/latest#ExtensionMethods


🔹 Method Extensions.DateAndTime.DateTimeExtensions.Elapsed(System.DateTime)

Elapseds the time.

Param Description
datetime The datetime.

Returns: TimeSpan


🔹 Method Extensions.DateAndTime.DateTimeExtensions.WeekOfYear(System.DateTime,System.Globalization.CalendarWeekRule,System.DayOfWeek)

Weeks the of year.

Param Description
datetime The datetime.
weekrule The weekrule.
firstDayOfWeek The first day of week.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.WeekOfYear(System.DateTime,System.DayOfWeek)

Weeks the of year.

Param Description
datetime The datetime.
firstDayOfWeek The first day of week.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.WeekOfYear(System.DateTime,System.Globalization.CalendarWeekRule)

Weeks the of year.

Param Description
datetime The datetime.
weekrule The weekrule.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.WeekOfYear(System.DateTime)

Weeks the of year.

Param Description
datetime The datetime.
weekrule The weekrule.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.GetDateTimeForDayOfWeek(System.DateTime,System.DayOfWeek,System.DayOfWeek)

Gets the date time for day of week.

Param Description
datetime The datetime.
day The day.
firstDayOfWeek The first day of week.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.FirstDateTimeOfWeek(System.DateTime)

Firsts the date time of week.

Param Description
datetime The datetime.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.FirstDateTimeOfWeek(System.DateTime,System.DayOfWeek)

Firsts the date time of week.

Param Description
datetime The datetime.
firstDayOfWeek The first day of week.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.DaysFromFirstDayOfWeek(System.DayOfWeek,System.DayOfWeek)

Dayses from first day of week.

Param Description
current The current.
firstDayOfWeek The first day of week.

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.IsWeekend(System.DateTime)

Figure out if DateTime holds a date value that is a weekend

Param Description
value

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.Readable(System.DateTime)

Returns given time as string formated to dd.MM.yyyy HH:mm:ss

Param Description
dateTime

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.ReadableMs(System.DateTime)

Returns given time as string formated to dd.MM.yyyy HH:mm:ss:ms

Param Description
dateTime

Returns:


🔹 Method Extensions.DateAndTime.DateTimeExtensions.UnixTimeStampToDateTime(System.Double)

Returns given unix timestamp as DateTime

Param Description
unixTimeStamp

Returns:


🔴 Type Extensions.Enumeration.EnumExtensions

Enum related extension methods


🔹 Method Extensions.Enumeration.EnumExtensions.GetDescription2(0,System.Type)

Returns DescriptionAttribute value for enum

Type Param Description
T
U
Param Description
enumerationValue
attributeType

Returns:


🔹 Method Extensions.Enumeration.EnumExtensions.GetDescription1(0)

Returns DescriptionAttribute value for enum

Type Param Description
T
Param Description
enumerationValue

Returns:


🔹 Method Extensions.Enumeration.EnumExtensions.GetFlags(System.Enum)

https://stackoverflow.com/questions/5542816/printing-flags-enum-as-separate-flags

Param Description
value

Returns:


🔴 Type Extensions.Linq.LinqExtensions

Linq related extension methods

http://extensionoverflow.codeplex.com/SourceControl/latest#ExtensionMethods


🔹 Method Extensions.Linq.LinqExtensions.ToCSVString(System.Linq.IOrderedQueryable)

Converts the Linq data to a comma separated string including header.

Param Description
data The data.

Returns:


🔹 Method Extensions.Linq.LinqExtensions.ToCSVString(System.Linq.IOrderedQueryable,System.String)

Converts the Linq data to a comma separated string including header.

Param Description
data The data.
delimiter The delimiter.

Returns:


🔹 Method Extensions.Linq.LinqExtensions.ToCSVString(System.Linq.IOrderedQueryable,System.String,System.String)

Converts the Linq data to a comma separated string including header.

Param Description
data The data.
delimiter The delimiter.
nullvalue The null value.

Returns:


🔹 Method Extensions.Linq.LinqExtensions.ForEach1(System.Collections.Generic.IEnumerable{0},System.Action{``0})

Shortcut for foreach statement

Type Param Description
T
Param Description
enum
mapFunction

🔹 Method Extensions.Linq.LinqExtensions.OrderBy1(System.Collections.Generic.IEnumerable{0},System.String)

Orders Enumerable using given sort expression Example: users.OrderBy("Name desc")

Type Param Description
T
Param Description
list
sortExpression Property and sort direction

Returns:


🔹 Method Extensions.Linq.LinqExtensions.Randomize1(System.Collections.Generic.IEnumerable{0})

Returns randomly ordered Enumerable

Type Param Description
T
Param Description
target

Returns:


🔹 Method Extensions.Linq.LinqExtensions.ToCollection1(System.Collections.Generic.IEnumerable{0})

Convert a [1](https://www.google.cz/search?q=System.Collections.Generic.IEnumerable1) to a [1](https://www.google.cz/search?q=System.Collections.ObjectModel.Collection1)

Type Param Description
T
Param Description
enumerable

Returns:


🔹 Method Extensions.Linq.LinqExtensions.OrderBy2(System.Collections.Generic.IEnumerable{0},System.Func{0,1},System.Boolean)

2](https://www.google.cz/search?q=System.Linq.Enumerable.OrderBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})) and [2 shortcut

Type Param Description
TSource
TKey
Param Description
enumerable
keySelector
descending

Returns:


🔹 Method Extensions.Linq.LinqExtensions.OrderBy1(System.Collections.Generic.IEnumerable{0},System.Func{0,System.IComparable},System.Func{0,System.IComparable},System.Func{``0,System.IComparable}[])

Order by multiple properties http://www.extensionmethod.net/csharp/ienumerable-t/orderby

Type Param Description
TSource
Param Description
enumerable
keySelector1
keySelector2
keySelectors

Returns:


🔹 Method Extensions.Linq.LinqExtensions.OrderBy1(System.Collections.Generic.IEnumerable{0},System.Boolean,System.Func{0,System.IComparable},System.Func{0,System.IComparable}[])

OrderBy by multiple properties http://www.extensionmethod.net/csharp/ienumerable-t/orderby

Type Param Description
TSource
Param Description
enumerable
descending True if descending
keySelector
keySelectors

Returns:


🔹 Method Extensions.Linq.LinqExtensions.Filter1(System.Collections.Generic.IEnumerable{0},System.Func{``0,System.Boolean})

Allows you to filter an [1](https://www.google.cz/search?q=System.Collections.Generic.IEnumerable1)

http://www.extensionmethod.net/csharp/ienumerable-t/filter

Type Param Description
T
Param Description
list
filterParam

Returns:


🔹 Method Extensions.Linq.LinqExtensions.Concat1(System.Collections.Generic.IEnumerable{0},``0)

Adds an element to an [1](https://www.google.cz/search?q=System.Collections.Generic.IEnumerable1)

Type Param Description
T
Param Description
target
element

Returns:


🔹 Method Extensions.Linq.LinqExtensions.JoinItems1(0,System.String)

Concatenates the members of a constructed [1](https://www.google.cz/search?q=System.Collections.Generic.IEnumerable1)

collection of type String , using the specified separator between each member.

Type Param Description
T
Param Description
collection
separator

Returns:



🔴 Type Extensions.Xml.XmlExtensions

XML related extensions


🔹 Method Extensions.Xml.XmlExtensions.Beautify(System.Xml.Linq.XDocument)

Formats given XML document

Param Description
doc

Returns:


🔹 Method Extensions.Xml.XmlExtensions.ToXmlDocument(System.Xml.Linq.XDocument)

Converts XDocument to XmlDocument

Param Description
xDocument

Returns:


🔹 Method Extensions.Xml.XmlExtensions.ToXDocument(System.Xml.XmlDocument)

Converts XmlDocument to XDocument

Param Description
xmlDocument

Returns:


🔹 Method Extensions.Xml.XmlExtensions.ToXmlDocument(System.Xml.Linq.XElement)

Converts XElement to XmlDocument

Param Description
xElement

Returns:


🔹 Method Extensions.Xml.XmlExtensions.ToMemoryStream(System.Xml.XmlDocument)

Converts XmlDocument to Stream

Param Description
doc

Returns:


Clone this wiki locally