hw.ReplaceVariables
14.2.0
See the version list below for details.
dotnet add package hw.ReplaceVariables --version 14.2.0
NuGet\Install-Package hw.ReplaceVariables -Version 14.2.0
<PackageReference Include="hw.ReplaceVariables" Version="14.2.0" />
paket add hw.ReplaceVariables --version 14.2.0
#r "nuget: hw.ReplaceVariables, 14.2.0"
// Install hw.ReplaceVariables as a Cake Addin
#addin nuget:?package=hw.ReplaceVariables&version=14.2.0
// Install hw.ReplaceVariables as a Cake Tool
#tool nuget:?package=hw.ReplaceVariables&version=14.2.0
Example:
using hw.ReplaceVariables;
static public class Example
{
public static void TestMethod()
{
var myData = new MyData();
var format = "i: $(InvoiceDate) - n: $(Now) - id: $(InvoiceDate.Date) - in: $(ImportantNumber) - asis: $(=ImportantNumber) ";
var expectedResult = "i: 22.04.2014 22:57:34 - n: 27.05.2014 22:57:34 - id: 22.04.2014 - in: 42 - asis: $(ImportantNumber) ";
var result = format.ReplaceVariables(myData);
Tracer.Assert(result == expectedResult);
}
sealed class MyData
{
[Visible]
DateTimeSpecial InvoiceDate { get { return new DateTimeSpecial(new DateTime(2014,5,27,22,57,34).AddDays(-35)); } }
[Visible]
DateTimeSpecial Now = new DateTimeSpecial(new DateTime(2014, 5, 27, 22, 57, 34));
[Visible]
int ImportantNumber = 42;
}
sealed class DateTimeSpecial
{
DateTime _value;
public DateTimeSpecial(DateTime value) { _value = value; }
[Visible]
int Day { get { return _value.Day; } }
[Visible]
int Month { get { return _value.Month; } }
[Visible]
int Year { get { return _value.Year; } }
[Visible]
string Date { get { return _value.Date.ToShortDateString(); } }
public override string ToString() { return _value.ToString(); }
}
}
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- dependency to core removed
- file name corrected