Search Results

Search found 1 results on 1 pages for 'chriso'.

Page 1/1 | 1 

  • Calling a static Func from a static class using reflection

    - by ChrisO
    Given the static class: public static class Converters { public static Func<Int64, string> Gold = c => String.Format("{0}g {1}s {2}c", c/10000, c/100%100, c%100); } I am receiving the Func name from a database as a string (regEx.Converter). How can I invoke the Gold Func using reflection? Here is what I have so far: var converter = typeof(Converters).GetMember(regEx.Converter); if (converter.Count() != 0) { //throw new ConverterNotFoundException; } matchedValue = converter.Invoke(null, new object[]{matchedValue}) as string;

    Read the article

1