反射加载

从SmartCoder里提取出来的代码:反射加载代码片断

过滤器有很多个备选,动态选择。

private IFilter getFilter(string filterName)
{
Type o = Type.GetType(filterName);//加载类型
IFilter filter = (IFilter)Activator.CreateInstance(o, true);
return filter;
}

<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<configSections>
<section name=”FilterSetting” type=”TemplateEngine.FilterSettingSection, TemplateEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null” allowDefinition=”Everywhere” allowExeDefinition=”MachineToApplication” restartOnExternalChanges=”true” />
</configSections>
<FilterSetting default=”DefaultFilter”>
<Filters>
<clear />
<add name=”DefaultFilter” type=”TemplateEngine.Filter.DefaultFilter,TemplateEngine,Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”/>
<add name=”Filter1″ type=”TemplateEngine.DefaultFilter,Test”  />
<add name=”Filter2″ type=”Test.Filter2,Test”  />
<add name=”Filter3″ type=”Test.Filter3,Test”  />
<add name=”Filter4″ type=”Test.Filter4,Test”  />
</Filters>
</FilterSetting>
</configuration>

Json.Net DateTime Problem

var jsonContent =JsonConvert.SerializeObject(responseModel, Formatting.None, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd hh:mm:ss" });"OrgDateTime":"2013-11-12 09:55:00" 

问题描述:json 时间  多了个T

经验证:此处理方法有效!

转自:http://hi.baidu.com/jingjie520/item/3effca6ddb44e190c5d249db