.net - How do I configure a property of a static class in Spring.NET? -
how configure static class via spring .net?
consider following class:
static class abc { public interface xyz { get; set; } public void show() { xyz.show(); } }
maybe workaround can help.. not static class works one
namespace nyan { public class util{ protected util(){} //to avoid accidental instatiation public static string datetimeformat = "hh:mm:ss"; public static datetime parsedate(string sdate) { return datetime.parseexact(sdate, datetimeformat, cultureinfo.invariantculture); } } } <object id="util" type="nyan.util, nyan" singleton="true"> <property name="datetimeformat" value="hh-mm-ss" /> </object
and used other static class:
protected void page_load(object sender, eventargs e) { datetime sdate = nyan.util.parsedate("15-15-15"); //parsed injected format }
Comments
Post a Comment