Class ExtensionsLib
- Namespace
- PHCLibrary
- Assembly
- PHCLibrary.dll
public class ExtensionsLib
ExtensionsLib
Fields
EncryptionKey
public const string EncryptionKey = "IsEncrypt_"
Field Value
- string
Indentation
public const string Indentation = " "
Field Value
- string
Methods
AddApostrophes(string)
Add apostrophe in the beggining and end of the word.
[Extension]
public static string AddApostrophes(this string source)
Parameters
| Nome |
Tipo |
Descrição |
source |
string |
|
Returns
- string
AddBrackets(string)
Add [ ... ] to each element that the string contains, for example 'test' will be '[test]' and 'alias.test' will be '[alias].[test]'
[Extension]
public static string AddBrackets(this string item)
Parameters
| Nome |
Tipo |
Descrição |
item |
string |
|
Returns
- string
AddIf<T>(List<T>, T)
Adds the element of the specified collection to the end of the source if element is not nothing.
[Extension]
public static void AddIf<T>(this List<T> source, T item)
Parameters
| Nome |
Tipo |
Descrição |
source |
List<T> |
|
item |
T |
|
Type Parameters
T
AddItens<T>(List<T>, params T[])
Adds several elements of the specified collection to the end of the source.
[Extension]
public static void AddItens<T>(this List<T> source, params T[] itens)
Parameters
| Nome |
Tipo |
Descrição |
source |
List<T> |
|
itens |
T[] |
|
Type Parameters
T
AddPercentages(string)
Add percentages in the beggining and end of the word.
Useful to do "Like" queries
[Extension]
public static string AddPercentages(this string source)
Parameters
| Nome |
Tipo |
Descrição |
source |
string |
|
Returns
- string
AddRangeIf<T>(List<T>, IEnumerable<T>)
Adds the elements of the specified collection to the end of the source if have elements.
[Extension]
public static void AddRangeIf<T>(this List<T> source, IEnumerable<T> Collection)
Parameters
Type Parameters
T
AddTime(DateTime, string)
[Extension]
public static DateTime AddTime(this DateTime source, string time)
Parameters
Returns
- DateTime
AddToParent<T>(T, ICollection<T>)
Adds an item to the parent.
[Extension]
public static T AddToParent<T>(this T source, ICollection<T> parent)
Parameters
Returns
- T
Type Parameters
T
AddWorkingDays(DateTime, int)
[Extension]
public static DateTime AddWorkingDays(this DateTime source, int days)
Parameters
Returns
- DateTime
AppendChildIf(XElement, XElement)
[Extension]
public static XElement AppendChildIf(this XElement source, XElement newChild)
Parameters
Returns
- XElement
AppendLines(StringBuilder, IList<string>, string)
Execute a For Each in the received list and execute an AppendLine to StringBuilder, using to avoid writing the cycle
[Extension]
public static StringBuilder AppendLines(this StringBuilder msgItem, IList<string> lines, string indent = "")
Parameters
Returns
- StringBuilder
BreakLines(string)
Replaces new line character
[Extension]
public static string BreakLines(this string texto)
Parameters
| Nome |
Tipo |
Descrição |
texto |
string |
|
Returns
- string
Clone(Uri)
[Extension]
public static Uri Clone(this Uri value)
Parameters
| Nome |
Tipo |
Descrição |
value |
Uri |
|
Returns
- Uri
Clone(HttpContext)
[Extension]
public static IWSContext Clone(this HttpContext contextItem)
Parameters
Returns
- IWSContext
ConvertFromBase64String(string)
Get the UTF8 string from Base64
[Extension]
public static string ConvertFromBase64String(this string source)
Parameters
| Nome |
Tipo |
Descrição |
source |
string |
|
Returns
- string
[Extension]
public static string DecimalFormatter(this decimal source, int decimalPlaces)
Parameters
| Nome |
Tipo |
Descrição |
source |
decimal |
|
decimalPlaces |
int |
|
Returns
- string
DecimalTruncate(decimal, int)
[Extension]
public static decimal DecimalTruncate(this decimal source, int decimalPlacesToTruncate)
Parameters
| Nome |
Tipo |
Descrição |
source |
decimal |
|
decimalPlacesToTruncate |
int |
|
Returns
- decimal
Decrypt(string)
[Extension]
public static string Decrypt(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
DefaultIfEmpty(DateTime, Func<DateTime>)
[Extension]
public static DateTime DefaultIfEmpty(this DateTime source, Func<DateTime> defaultValueFunc)
Parameters
Returns
- DateTime
DefaultIfNothing<TSource>(TSource, Func<TSource>)
[Extension]
public static TSource DefaultIfNothing<TSource>(this TSource source, Func<TSource> defaultValueFunction)
Parameters
| Nome |
Tipo |
Descrição |
source |
TSource |
|
defaultValueFunction |
Func<TSource> |
|
Returns
- TSource
Type Parameters
TSource
DoubleTruncate(double, int)
[Extension]
public static double DoubleTruncate(this double source, int decimalPlacesToTruncate)
Parameters
| Nome |
Tipo |
Descrição |
source |
double |
|
decimalPlacesToTruncate |
int |
|
Returns
- double
Encrypt(string)
[Extension]
public static string Encrypt(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
EncryptToLog(string)
[Extension]
public static string EncryptToLog(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
EndOfMonthDate(DateTime)
[Extension]
public static DateTime EndOfMonthDate(this DateTime value)
Parameters
Returns
- DateTime
EpochFromDate(DateTime)
[Extension]
public static double EpochFromDate(this DateTime targetDate)
Parameters
Returns
- double
EqualsWithIgnoreCase(string, string)
Determines whether this string and a specified System.String object have the same value and ignore case for invariante culture.
[Extension]
public static bool EqualsWithIgnoreCase(this string source, string value)
Parameters
Returns
- bool
FirstOrDefault<T>(IEnumerable<T>, Func<T>)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
[Extension]
public static T FirstOrDefault<T>(this IEnumerable<T> source, Func<T> getDefaultValueFunction)
Parameters
Returns
- T
Type Parameters
T
FirstOrDefault<T>(IList)
[Extension]
public static T FirstOrDefault<T>(this IList list)
Parameters
| Nome |
Tipo |
Descrição |
list |
IList |
|
Returns
- T
Type Parameters
T
FirstOrDefault<T>(Task<IList>)
[Extension]
public static T FirstOrDefault<T>(this Task<IList> list)
Parameters
Returns
- T
Type Parameters
T
Forget(Task)
Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to async methods within async methods
[Extension]
public static void Forget(this Task taskItem)
Parameters
| Nome |
Tipo |
Descrição |
taskItem |
Task |
The task whose result is to be ignored.
|
[Extension]
public static List<string> Format(this MethodParameter parameter)
Parameters
Returns
- List<string>
[Extension]
public static List<string> Format(this StackFrame[] frames)
Parameters
Returns
- List<string>
[Extension]
public static List<string> Format(this StackFrame[] frames, string sourceFileName, string sourceCaller, int sourceLineNumber)
Parameters
Returns
- List<string>
[Extension]
public static List<string> Format(this Exception ex, bool innerException, string filePath, string caller, int lineNumber)
Parameters
Returns
- List<string>
[Extension]
public static List<string> Format(this Exception ex, string filePath, string caller, int lineNumber)
Parameters
Returns
- List<string>
Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.
[Extension]
public static string FormatWith(this string format, params object[] args)
Parameters
| Nome |
Tipo |
Descrição |
format |
string |
A composite format string.
|
args |
object[] |
An object array that contains zero or more objects to format.
|
Returns
- string
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.
GetAndSetValueIfNothing<T>(ref T, Func<T>)
[Extension]
public static T GetAndSetValueIfNothing<T>(this ref T source, Func<T> getValue)
Parameters
| Nome |
Tipo |
Descrição |
source |
T |
|
getValue |
Func<T> |
|
Returns
- T
Type Parameters
T
GetDateSeparator(string)
Get the date separator, example '01.02.2000' returns '.' and for example '01/02/2000' returns '/'
[Extension]
public static string GetDateSeparator(this string strDate)
Parameters
| Nome |
Tipo |
Descrição |
strDate |
string |
|
Returns
- string
GetDayEndOfMonth(DateTime)
[Extension]
public static int GetDayEndOfMonth(this DateTime value)
Parameters
Returns
- int
GetDigits4(decimal)
[Extension]
public static int GetDigits4(this decimal value)
Parameters
Returns
- int
GetFirstAlias(string, string)
Get the first alias but not remove brackets
[Extension]
public static string GetFirstAlias(this string value, string separator = ".")
Parameters
Returns
- string
GetFirstFieldName(string)
Get the first field name and remove brackets
[Extension]
public static string GetFirstFieldName(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
GetLastAlias(string, string)
Get the last alias and remove brackets
[Extension]
public static string GetLastAlias(this string value, string separator = ".")
Parameters
Returns
- string
GetLines(string, StringSplitOptions)
Array of strings that were obtained, automatically searching for the separator character.
[Extension]
public static string[] GetLines(this string msgtext, StringSplitOptions splitOption = StringSplitOptions.None)
Parameters
Returns
- string[]
GetLocaleKeyMonth(DateTime)
[Extension]
public static string GetLocaleKeyMonth(this DateTime value)
Parameters
Returns
- string
GetReplicated(string, int)
[Extension]
public static string GetReplicated(this string carater, int nCount)
Parameters
| Nome |
Tipo |
Descrição |
carater |
string |
|
nCount |
int |
|
Returns
- string
Transform the strinf into a safe currency format
[Extension]
public static string GetSafeCurrencyFormat(this string currencyValue, ref string decimalSeparator = null)
Parameters
| Nome |
Tipo |
Descrição |
currencyValue |
string |
|
decimalSeparator |
string |
|
Returns
- string
GetSafeString(string)
[Extension]
public static string GetSafeString(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
GetUtf8Bytes(string)
This function will return the UTF8 bytes of the string
[Extension]
public static byte[] GetUtf8Bytes(this string source)
Parameters
| Nome |
Tipo |
Descrição |
source |
string |
|
Returns
- byte[]
GetWords(string, StringSplitOptions)
[Extension]
public static string[] GetWords(this string msgtext, StringSplitOptions splitOption = StringSplitOptions.None)
Parameters
Returns
- string[]
HaveItens<T>(IEnumerable<T>)
Verify if the source not is null and if have values.
[Extension]
public static bool HaveItens<T>(this IEnumerable<T> source)
Parameters
Returns
- bool
Type Parameters
T
ISOtoDate(string)
Convert a iso string date yyyy-MM-dd into a datetime object but only the date
[Extension]
public static DateTime ISOtoDate(this string sDate)
Parameters
| Nome |
Tipo |
Descrição |
sDate |
string |
|
Returns
- DateTime
IsBetween<T>(T, T, T)
[Extension]
public static bool IsBetween<T>(this T item, T minValue, T maxValue) where T : IComparable
Parameters
| Nome |
Tipo |
Descrição |
item |
T |
|
minValue |
T |
|
maxValue |
T |
|
Returns
- bool
Type Parameters
T
IsDayEndOfMonth(DateTime)
[Extension]
public static bool IsDayEndOfMonth(this DateTime value)
Parameters
Returns
- bool
IsDigit(char)
Whether the character is contained in the group {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
[Extension]
public static bool IsDigit(this char value)
Parameters
| Nome |
Tipo |
Descrição |
value |
char |
|
Returns
- bool
IsFieldTagged(List<string>, string)
By default when fieldsTagged is empty we always assume that the field is tagged
[Extension]
public static bool IsFieldTagged(this List<string> fieldsTagged, string fieldName)
Parameters
Returns
- bool
IsIn<T>(T, IEnumerable<T>)
Determina se uma sequência contém um dos elementos especificados em values.
[Extension]
public static bool IsIn<T>(this T source, IEnumerable<T> values)
Parameters
Returns
- bool
Type Parameters
T
IsIn<T>(T, IEqualityComparer<T>, params T[])
Determina se uma sequência contém um dos elementos especificados, usando um comparador IEqualityComparer<T>.
[Extension]
public static bool IsIn<T>(this T source, IEqualityComparer<T> comparer, params T[] args)
Parameters
Returns
- bool
Type Parameters
T
IsIn<T>(T, params T[])
Determina se uma sequência contém um dos elementos especificados usando o comparador de igualdade padrão.
[Extension]
public static bool IsIn<T>(this T source, params T[] args)
Parameters
| Nome |
Tipo |
Descrição |
source |
T |
|
args |
T[] |
|
Returns
- bool
Type Parameters
T
IsIncluded(AuthorizationMethods, params AuthorizationMethods[])
Whether the item is included in the list
[Extension]
public static bool IsIncluded(this AuthorizationMethods valueItem, params AuthorizationMethods[] options)
Parameters
Returns
- bool
IsIncluded(AuthorizationStatus, params AuthorizationStatus[])
Whether the item is included in the list
[Extension]
public static bool IsIncluded(this AuthorizationStatus valueItem, params AuthorizationStatus[] options)
Parameters
Returns
- bool
IsIncluded(SerializerTypeEnum, params SerializerTypeEnum[])
Whether the item is included in the list
[Extension]
public static bool IsIncluded(this SerializerTypeEnum valueItem, params SerializerTypeEnum[] options)
Parameters
Returns
- bool
IsIncluded(char, params char[])
Whether the item is included in the list
[Extension]
public static bool IsIncluded(this char valueItem, params char[] options)
Parameters
| Nome |
Tipo |
Descrição |
valueItem |
char |
|
options |
char[] |
|
Returns
- bool
IsIncluded(string, params string[])
Whether the item is included in the list
[Extension]
public static bool IsIncluded(this string valueItem, params string[] options)
Parameters
Returns
- bool
IsOnlyDigits(string)
If the string is composed only of characters that are contained in the group {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
[Extension]
public static bool IsOnlyDigits(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- bool
IsRequestAvailable(HttpContext)
[Extension]
public static bool IsRequestAvailable(this HttpContext context)
Parameters
Returns
- bool
IsResponseAvailable(HttpContext)
[Extension]
public static bool IsResponseAvailable(this HttpContext context)
Parameters
Returns
- bool
IsSimpleType(Type)
[Extension]
public static bool IsSimpleType(this Type myType)
Parameters
| Nome |
Tipo |
Descrição |
myType |
Type |
|
Returns
- bool
IsValidDateTime(DateTime)
[Extension]
public static bool IsValidDateTime(this DateTime value)
Parameters
Returns
- bool
IsVoid(bool)
[Extension]
public static bool IsVoid(this bool lValor)
Parameters
| Nome |
Tipo |
Descrição |
lValor |
bool |
|
Returns
- bool
IsVoid(byte)
If is equal to Byte.MinValue or nothing
[Extension]
public static bool IsVoid(this byte expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
byte |
|
Returns
- bool
IsVoid(byte[])
If the array is nothing or is empty or all elements in the list are equal to Byte.MinValue
[Extension]
public static bool IsVoid(this byte[] expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
byte[] |
|
Returns
- bool
IsVoid(char)
[Extension]
public static bool IsVoid(this char expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
char |
|
Returns
- bool
IsVoid(IDictionary)
If the list is empty or nothing not the itens in itself
[Extension]
public static bool IsVoid(this IDictionary value)
Parameters
Returns
- bool
IsVoid(IEnumerable)
If the list is empty or nothing not the itens in itself
[Extension]
public static bool IsVoid(this IEnumerable list)
Parameters
Returns
- bool
IsVoid(IList)
If the list is empty or nothing not the itens in itself
[Extension]
public static bool IsVoid(this IList list)
Parameters
| Nome |
Tipo |
Descrição |
list |
IList |
|
Returns
- bool
IsVoid(DBNull)
[Extension]
public static bool IsVoid(this DBNull expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
DBNull |
|
Returns
- bool
IsVoid(DataTable)
[Extension]
public static bool IsVoid(this DataTable source)
Parameters
Returns
- bool
IsVoid(DateTime)
If is empty or nothing or if the date part is equal to Utils.Dates.MinBusinessDate.Date
[Extension]
public static bool IsVoid(this DateTime value)
Parameters
Returns
- bool
IsVoid(decimal)
If is equal to zero or nothing
[Extension]
public static bool IsVoid(this decimal expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
decimal |
|
Returns
- bool
IsVoid(double)
If is equal to zero or nothing
[Extension]
public static bool IsVoid(this double expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
double |
|
Returns
- bool
IsVoid(int)
If is equal to zero or nothing
[Extension]
public static bool IsVoid(this int expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
int |
|
Returns
- bool
IsVoid(long)
If is equal to zero or nothing
[Extension]
public static bool IsVoid(this long expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
long |
|
Returns
- bool
IsVoid(string)
[Extension]
public static bool IsVoid(this string expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
string |
|
Returns
- bool
IsVoid(string[])
If the list is empty or nothing not the itens in itself
[Extension]
public static bool IsVoid(this string[] expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
string[] |
|
Returns
- bool
IsVoid(StringBuilder)
[Extension]
public static bool IsVoid(this StringBuilder expression)
Parameters
Returns
- bool
JsonIsVoid(string)
[Extension]
public static bool JsonIsVoid(this string expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
string |
|
Returns
- bool
NotHaveItens<T>(IEnumerable<T>)
Verify if the source is null or if not have values.
[Extension]
public static bool NotHaveItens<T>(this IEnumerable<T> source)
Parameters
Returns
- bool
Type Parameters
T
PadLeft(string, int, string)
[Extension]
public static string PadLeft(this string value, int lenght, string fillCaracter = " ")
Parameters
Returns
- string
PadRight(string, int, string)
[Extension]
public static string PadRight(this string value, int lenght, string fillCaracter = " ")
Parameters
Returns
- string
PathCombine(string, string)
[Extension]
public static string PathCombine(this string path1, string path2)
Parameters
Returns
- string
RemoveBrackets(string)
Remove [ ... ] from each element that the string contains, for example '[test]' will be 'test' and '[alias].[test]' will be 'alias.test'
[Extension]
public static string RemoveBrackets(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
RemoveDuplicates<T>(IEnumerable<T>)
Removes duplicate entries from a sequence of elements by comparing them using the Equals method.
Provides an alternative to the Distinct method, which compares elements using their GetHashCode method.
[Extension]
public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> source)
Parameters
| Nome |
Tipo |
Descrição |
source |
IEnumerable<T> |
The sequence of elements to filter.
|
Returns
- IEnumerable<T>
The original sequence with duplicate entries removed.
Type Parameters
T
The type of the elements of the sequence.
RemoveDuplicates<T>(IEnumerable<T>, Func<T, T, bool>)
Removes duplicate entries from a sequence of elements by using the specified Func to compare elements and determine
whether they are equal.
Provides an alternative to the Distinct method, which compares elements using their GetHashCode method.
[Extension]
public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> source, Func<T, T, bool> equater)
Parameters
| Nome |
Tipo |
Descrição |
source |
IEnumerable<T> |
The sequence of elements to filter.
|
equater |
Func<T, T, bool> |
A Func that takes 2 elements of type T and returns true if they are equal, else false.
|
Returns
- IEnumerable<T>
The original sequence with duplicate entries removed.
Type Parameters
T
The type of the elements of the sequence.
RemoveFirstAlias(string)
Remove brackets and the first alias
[Extension]
public static string RemoveFirstAlias(this string value)
Parameters
| Nome |
Tipo |
Descrição |
value |
string |
|
Returns
- string
RemoveSQLInvalidChars(string)
Remove chars SQL Injection
[Extension]
public static string RemoveSQLInvalidChars(this string expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
string |
|
Returns
- string
ReplaceWhenTagged<T>(List<string>, string, T, T)
By default when fieldsTagged is empty we always replace
[Extension]
public static T ReplaceWhenTagged<T>(this List<string> fieldsTagged, string fieldName, T valueToReplace, T valueToFaulBack)
Parameters
| Nome |
Tipo |
Descrição |
fieldsTagged |
List<string> |
|
fieldName |
string |
|
valueToReplace |
T |
|
valueToFaulBack |
T |
|
Returns
- T
Type Parameters
T
RoundAwayZero(decimal)
Round using MidpointRounding.AwayFromZero
[Extension]
public static decimal RoundAwayZero(this decimal value)
Parameters
Returns
- decimal
RoundAwayZero(decimal, int)
Round using MidpointRounding.AwayFromZero
[Extension]
public static decimal RoundAwayZero(this decimal value, int decimals)
Parameters
Returns
- decimal
RoundAwayZero(double)
Round using MidpointRounding.AwayFromZero
[Extension]
public static double RoundAwayZero(this double value)
Parameters
| Nome |
Tipo |
Descrição |
value |
double |
|
Returns
- double
RoundAwayZero(double, int)
Round using MidpointRounding.AwayFromZero
[Extension]
public static double RoundAwayZero(this double value, int decimals)
Parameters
| Nome |
Tipo |
Descrição |
value |
double |
|
decimals |
int |
|
Returns
- double
SafeStartNew(TaskFactory, IWSContext, Action)
[Extension]
public static Task SafeStartNew(this TaskFactory factory, IWSContext context, Action actionItem)
Parameters
Returns
- Task
SafeStartNew(TaskFactory, Action)
[Extension]
public static Task SafeStartNew(this TaskFactory factory, Action actionItem)
Parameters
Returns
- Task
SafeStartNew<T>(TaskFactory, IWSContext, Func<T>)
[Extension]
public static Task<T> SafeStartNew<T>(this TaskFactory factory, IWSContext context, Func<T> actionItem)
Parameters
Returns
- Task<T>
Type Parameters
T
SafeStartNew<T>(TaskFactory, Func<T>)
[Extension]
public static Task<T> SafeStartNew<T>(this TaskFactory factory, Func<T> actionItem)
Parameters
Returns
- Task<T>
Type Parameters
T
SerialtoDate(string)
Convert a serial string date yyyyMMdd into a datetime object but only the date
[Extension]
public static DateTime SerialtoDate(this string sDate)
Parameters
| Nome |
Tipo |
Descrição |
sDate |
string |
|
Returns
- DateTime
SplitWithOutEmptyEntries(string, params char[])
Retorna uma matriz de cadeia de caracteres que contém as subcadeias nesta cadeia que são delimitadas por elementos de uma matriz de caracteres Unicode especificada e não retornam elementos de matriz vazia..
[Extension]
public static string[] SplitWithOutEmptyEntries(this string source, params char[] separator)
Parameters
| Nome |
Tipo |
Descrição |
source |
string |
Texto que vai ser separada
|
separator |
char[] |
Uma matriz de caracteres Unicode que delimitam as substrings nesta cadeia, uma matriz vazia que não contém delimitadores ou nula.
|
Returns
- string[]
Retorna um vetor de strings
StartOfMonthDate(DateTime)
[Extension]
public static DateTime StartOfMonthDate(this DateTime value)
Parameters
Returns
- DateTime
SubStringX(string, int, int)
This function is immune to the fact that the sum of Start + Length can be greater than the Lengh of the variable, and does not raise the exception ArgumentOutOfRangeException
[Extension]
public static string SubStringX(this string text, int start, int length = -1)
Parameters
| Nome |
Tipo |
Descrição |
text |
string |
|
start |
int |
The zero-based starting character position of a substring in this instance.
|
length |
int |
The number of characters in the substring.
|
Returns
- string
A string that is equivalent to the substring of length, length that begins at startIndex in this instance, or Empty if startIndex is equal to the length of this instance and length is zero.
ThisItem<TSource>(TSource)
[Extension]
public static TSource ThisItem<TSource>(this TSource source)
Parameters
| Nome |
Tipo |
Descrição |
source |
TSource |
|
Returns
- TSource
Type Parameters
TSource
ToBoolean(decimal)
[Extension]
public static bool ToBoolean(this decimal value)
Parameters
Returns
- bool
ToBoolean(double)
[Extension]
public static bool ToBoolean(this double value)
Parameters
| Nome |
Tipo |
Descrição |
value |
double |
|
Returns
- bool
ToBoolean(int)
[Extension]
public static bool ToBoolean(this int value)
Parameters
| Nome |
Tipo |
Descrição |
value |
int |
|
Returns
- bool
ToBoolean(string)
Convert the caracter into the boolean equivalent
[Extension]
public static bool ToBoolean(this string lValor)
Parameters
| Nome |
Tipo |
Descrição |
lValor |
string |
|
Returns
- bool
ToCarater(bool)
[Extension]
public static string ToCarater(this bool lValor)
Parameters
| Nome |
Tipo |
Descrição |
lValor |
bool |
|
Returns
- string
ToCarater(DateTime)
[Extension]
public static string ToCarater(this DateTime dDate)
Parameters
Returns
- string
ToCarater(DateTime, string)
[Extension]
public static string ToCarater(this DateTime dDate, string sFormat)
Parameters
Returns
- string
ToDate(string)
Convert a string into a datetime object but only the date
[Extension]
public static DateTime ToDate(this string sDate)
Parameters
| Nome |
Tipo |
Descrição |
sDate |
string |
|
Returns
- DateTime
ToDateTime(double)
[Extension]
public static DateTime ToDateTime(this double time)
Parameters
| Nome |
Tipo |
Descrição |
time |
double |
|
Returns
- DateTime
ToDateTime(string)
Convert a string into a datetime object
[Extension]
public static DateTime ToDateTime(this string sDate)
Parameters
| Nome |
Tipo |
Descrição |
sDate |
string |
|
Returns
- DateTime
ToDecimal(string, ref bool)
[Extension]
public static decimal ToDecimal(this string value, ref bool lError = false)
Parameters
Returns
- decimal
ToDigit(bool)
[Extension]
public static string ToDigit(this bool lValor)
Parameters
| Nome |
Tipo |
Descrição |
lValor |
bool |
|
Returns
- string
ToDouble(string, ref bool)
[Extension]
public static double ToDouble(this string value, ref bool lError = false)
Parameters
Returns
- double
ToExtensoPt(int)
Converter para extenso um número inteiro
[Extension]
public static string ToExtensoPt(this int number)
Parameters
| Nome |
Tipo |
Descrição |
number |
int |
|
Returns
- string
ToHourAndMinutes(DateTime)
[Extension]
public static string ToHourAndMinutes(this DateTime tDateTime)
Parameters
Returns
- string
ToHourAndMinutesSerial(DateTime)
[Extension]
public static string ToHourAndMinutesSerial(this DateTime tDateTime)
Parameters
Returns
- string
ToHourMinutes(string)
Get only the hours and minutes os the string, the result it's always size 5
[Extension]
public static string ToHourMinutes(this string cTime)
Parameters
| Nome |
Tipo |
Descrição |
cTime |
string |
|
Returns
- string
ToISO(DateTime)
[Extension]
public static string ToISO(this DateTime dDate)
Parameters
Returns
- string
ToISO2(DateTime)
[Extension]
public static string ToISO2(this DateTime dDate)
Parameters
Returns
- string
ToISO3(DateTime)
[Extension]
public static string ToISO3(this DateTime dDate)
Parameters
Returns
- string
ToInteger(char)
[Extension]
public static int ToInteger(this char source)
Parameters
| Nome |
Tipo |
Descrição |
source |
char |
|
Returns
- int
ToInteger(decimal)
[Extension]
public static int ToInteger(this decimal source)
Parameters
Returns
- int
ToInteger(double)
[Extension]
public static int ToInteger(this double source)
Parameters
| Nome |
Tipo |
Descrição |
source |
double |
|
Returns
- int
ToInteger(string, ref bool)
[Extension]
public static int ToInteger(this string value, ref bool lError = false)
Parameters
Returns
- int
ToJoinString(IEnumerable<string>, string)
[Extension]
public static string ToJoinString(this IEnumerable<string> source, string separator)
Parameters
Returns
- string
ToList<TSource, TOutput>(IEnumerable<TSource>, Func<TSource, TOutput>)
[Extension]
public static List<TOutput> ToList<TSource, TOutput>(this IEnumerable<TSource> source, Func<TSource, TOutput> addItemFunction)
Parameters
| Nome |
Tipo |
Descrição |
source |
IEnumerable<TSource> |
|
addItemFunction |
Func<TSource, TOutput> |
|
Returns
- List<TOutput>
Type Parameters
TSource
TOutput
ToSerial(DateTime)
Convert a datetime object to the serial string but obly the date part
[Extension]
public static string ToSerial(this DateTime dDate)
Parameters
Returns
- string
ToStr(decimal)
[Extension]
public static string ToStr(this decimal expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
decimal |
|
Returns
- string
ToStr(double)
[Extension]
public static string ToStr(this double expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
double |
|
Returns
- string
ToStr(int)
[Extension]
public static string ToStr(this int expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
int |
|
Returns
- string
ToTime(DateTime)
[Extension]
public static string ToTime(this DateTime tDateTime)
Parameters
Returns
- string
ToTimeZoneDate(DateTime)
Mark as UTC and return only the date part
[Extension]
public static DateTime ToTimeZoneDate(this DateTime dataItem)
Parameters
Returns
- DateTime
ToTimeZoneDate(string)
Convert a string to a datetime object only the date part anda mark as UTC
[Extension]
public static DateTime ToTimeZoneDate(this string dt)
Parameters
Returns
- DateTime
ToTimeZoneDateTime(DateTime)
[Extension]
public static DateTime ToTimeZoneDateTime(this DateTime dt)
Parameters
Returns
- DateTime
ToType<TResult>(object)
[Extension]
public static TResult ToType<TResult>(this object source)
Parameters
| Nome |
Tipo |
Descrição |
source |
object |
|
Returns
- TResult
Type Parameters
TResult
Truncate(decimal, int)
[Extension]
public static decimal Truncate(this decimal value, int decimalPlaces)
Parameters
| Nome |
Tipo |
Descrição |
value |
decimal |
|
decimalPlaces |
int |
|
Returns
- decimal
UpperAlltrim(string)
[Extension]
public static string UpperAlltrim(this string expression)
Parameters
| Nome |
Tipo |
Descrição |
expression |
string |
|
Returns
- string
WeekNumber(DateTime)
[Extension]
public static int WeekNumber(this DateTime value)
Parameters
Returns
- int