Skip to content

Teodor92/MoreDotNet

Repository files navigation

MoreDotNet

Status

NuGet version

Coverage Status

Summary

This project is a collection of handy extension methods for the .NET Framework. The functionality of this package can be separated in the following groups:

Extension methods for common .NET types:


  • ICollection:
AddRange()
  • IDictionary:
GetOrDefault()
GetKeyIgnoringCase()
  • IEnumerable:
ForEach()
EmptyIfNull()
Shuffle()
ToString()
IsNullOrEmpty()
ToHashSet()
  • IList:
BinarySearch()
ToDataTable()
InsertionSort()
InsertWhere()
RemoveAll()
  • bool:
WhenTrue()
WhenFalse()
  • ByteArray:
GetString()
  • IConvertible:
To()
ToOrDefault()
ToOrOther()
ToOrNull()
  • IDataRecord:
GetNullable()
  • DateTime:
FirstDayOfMonth()
LastDayOfMonth()
NextDate()
Midnight()
Noon()
WithTime()
IsFuture()
IsPast()
IsWorkDay()
IsWeekend()
NextWorkday()
  • Enum:
GetDisplayName()
GetDescription()
  • Generics
IsBetween()
GetMemberName()
  • int:
RangeTo()
  • object:
Is()
IsNot()
As()
ToDictionary()
  • OperatingSystem:
IsWinXpOrHigher()
IsWinVistaOrHigher()
IsWin7OrHigher()
IsWin8OrHigher()
  • Random:
OneOf()
NextBool()
NextChar()
NextDateTime()
NextDouble()
NextString()
NextTimeSpan()
  • Stream:
ToByteArray()
ToStream()
  • string:
ToTitleCase()
CaseToWords()
Capitalize()
IsLike()
ToMaximumLengthString()
NthIndexOf()
RemoveLastCharacter()
RemoveLast()
RemoveFirstCharacter()
RemoveFirst()
  • Type:
IsNullable()
GetCoreType()
  • Xml:
XmlSerialize()
XmlDeserialize()
  • RomanNumeral:
IsValidRomanNumeral()
ParseRomanNumeral()
ToRomanNumeralString()

Static helpers


  • Directory:
CreateTempDirectory()
SafeDeleteDirectory()
  • File:
SaveStringToTempFile()
SaveByteArrayToTempFile()

Wrappers for transforming common static methods to instance methods


Example:

string.IsNullOrWhiteSpace(testStringVar)

Is transformed to:

testStringVar.IsNullOrWhiteSpace()

Installation

NOTE: The package is still under development and some bugs may exist!

You can install the library using NuGet into your project:

Install-Package MoreDotNet

Changelog

Version 0.7

  • Switched to .NET Standard.
  • APIs for Color, OperatingSystem and DataTable removed due to them missing in the .NET Standard API.

License

This package has MIT license. Refer to the LICENSE for detailed information.

Any questions, comments or additions

If you have a feature request or bug report, leave an issue on the issues page or send a pull request. For general questions and comments, use the StackOverflow forum.