NuGet Package hw.ReplaceVariables

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(); }
}
}.




Got any hw.ReplaceVariables Question?





Info

Version: 20.0.0.1
Author(s): hahoyer
Last Update: Wednesday, September 30, 2020
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/hahoyer/HWClassLibrary.cs
NuGet Url: https://www.nuget.org/packages/hw.ReplaceVariables


Install
Install-Package hw.ReplaceVariables
dotnet add package hw.ReplaceVariables
paket add hw.ReplaceVariables
hw.ReplaceVariables Download (Unzip the "nupkg" after downloading)





STATS

must-have-score

1.3

avg-downloads-per-day

1

days-since-last-release

1088