hw.ReplaceVariables
20.0.0.1
dotnet add package hw.ReplaceVariables --version 20.0.0.1
NuGet\Install-Package hw.ReplaceVariables -Version 20.0.0.1
<PackageReference Include="hw.ReplaceVariables" Version="20.0.0.1" />
paket add hw.ReplaceVariables --version 20.0.0.1
#r "nuget: hw.ReplaceVariables, 20.0.0.1"
// Install hw.ReplaceVariables as a Cake Addin
#addin nuget:?package=hw.ReplaceVariables&version=20.0.0.1
// Install hw.ReplaceVariables as a Cake Tool
#tool nuget:?package=hw.ReplaceVariables&version=20.0.0.1
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.
change: Upgrade to new style
14.3.0.0
- parameter checks
- access variables only when required by target string