ExpertCs.Utils
1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global ExpertCs.Utils --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local ExpertCs.Utils --version 1.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ExpertCs.Utils&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package ExpertCs.Utils --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ExpertCs.Utils
Helpful utilities and classes
The library will be extended
Use at your own risk
StringHelper.FormatWithExpressions - interpolates an input string using expressions calculated for a given object.
/// <summary>
/// Интерполирует входную строку используя выражения вычесленные для заданного объекта.
/// </summary>
/// <example>
/// var s = "p1={IntField,10:n2}, p2={StrProp}, p3={IntField}, p4={(DateProp.Year+5):n2}, p5={DateProp:g}, 10={7+3}, p7={GetType().Name}, p8={DArray[1]:p2}";
///
/// var c = new
/// {
/// DateProp = DateTime.Now,
/// IntField = 5,
/// StrProp = "-test text-",
/// DArray = new decimal[] { 2m, 4.3m, 7m }
/// };
///
/// var ret1 = ExpertCs.StringUtils.StringHelper.FormatWithExpressions(c, s);
///
/// var ret2 = c.FormatWithExpressions(s, System.Globalization.CultureInfo.GetCultureInfo("en"));
/// </example>
/// <param name="contextObject">Объект.</param>
/// <param name="interpolatedExpression">Выражение для форматирования.</param>
/// <param name="formatProvider"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="FormatException"></exception>
/// <returns></returns>
public static string FormatWithExpressions(
this object contextObject,
string interpolatedExpression,
IFormatProvider? formatProvider = null)
Полезный метод
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.