Содержит общие и часто используемые методы расширения.
Inheritance
System.Object
CommonExtensions
Namespace:InfinniPlatform.Extensions
Assembly:InfinniPlatform.Core.dll
public static class CommonExtensions : object
Methods
|
Improve this Doc
View Source
Проверяет, содержится ли подстрока в строке.
Declaration
public static bool Contains(this string target, string value, StringComparison comparisonType)
Parameters
Type |
Name |
Description |
System.String |
target |
|
System.String |
value |
|
StringComparison |
comparisonType |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Выполнить действие над объектом с подавлением возможных исключений.
Declaration
public static bool ExecuteSilent<T>(this T target, Action<T> action)
Parameters
Type |
Name |
Description |
T |
target |
Вызываемый объкт.
|
Action<T> |
action |
Действие над объектом.
|
Returns
Type |
Description |
System.Boolean |
Возвращает true, если действие выполнено без ошибок; иначе false.
|
Type Parameters
Name |
Description |
T |
Тип объекта.
|
|
Improve this Doc
View Source
Возвращает индекс первого вхождения подстроки в строку.
Declaration
public static int FindNextIndexOf(this string target, string value, int startIndex = 0, bool matchCase = false, bool wholeWord = false)
Parameters
Type |
Name |
Description |
System.String |
target |
|
System.String |
value |
|
System.Int32 |
startIndex |
|
System.Boolean |
matchCase |
|
System.Boolean |
wholeWord |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Возвращает индекс последнего вхождения подстроки в строку.
Declaration
public static int FindPreviousIndexOf(this string target, string value, int startIndex = 0, bool matchCase = false, bool wholeWord = false)
Parameters
Type |
Name |
Description |
System.String |
target |
|
System.String |
value |
|
System.Int32 |
startIndex |
|
System.Boolean |
matchCase |
|
System.Boolean |
wholeWord |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Заменяет в строке одну подстроку на другую.
Declaration
public static string Replace(this string target, string oldValue, string newValue, bool matchCase = false, bool wholeWord = false)
Parameters
Type |
Name |
Description |
System.String |
target |
|
System.String |
oldValue |
|
System.String |
newValue |
|
System.Boolean |
matchCase |
|
System.Boolean |
wholeWord |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Преобразует строку в перечисление заданного типа.
Declaration
public static TEnum ToEnum<TEnum>(this string target, TEnum defaultValue = null)where TEnum : struct
Parameters
Type |
Name |
Description |
System.String |
target |
|
TEnum |
defaultValue |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Заменяет прямую косую черту в строке на обратную косую черту.
Declaration
public static string ToFileSystemPath(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
Исходная строка.
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Заменяет обратную косую черту в строке на прямую косую черту.
Declaration
public static string ToWebPath(this string s)
Parameters
Type |
Name |
Description |
System.String |
s |
Исходная строка.
|
Returns
Type |
Description |
System.String |
|