mardi 30 décembre 2014

How to use C# extension methods with SmartFormat reflection syntax?

Is it possible to make the following example work with SmartFormat.NET?



void Main()
{
Dictionary<string,string> ps = new Dictionary<string, string>();

ps["Name"] = "Niels";

Smart.Format("{Name.Foo} is my name", ps).Dump();
}


public static class Extensions
{

public static string Foo(this string bar)
{
return bar.ToUpper();
}

}


This will return " is my name" in LinqPad.






Aucun commentaire:

Enregistrer un commentaire