tools in .Net
1.System.Web.HttpContext.Current
string mapPath = System.Web.HttpContext.Current.Server.MapPath("~/Data");
2.AssemblyUtil.GetCurrentAssemblyPath();
3.Directory
Directory.GetParent("ccc").FullName
4.Path
Path.Combine(Directory.GetParent(mapPath).FullName, "Data");
5.using System.Xml.Serialization;
//T is generic
var se= new XmlSerializer(typeof(T));
using (var r = new System.IO.StreamReader("test.xml"))
{
result = (T)se.Deserialize(r);
}
string mapPath = System.Web.HttpContext.Current.Server.MapPath("~/Data");
2.AssemblyUtil.GetCurrentAssemblyPath();
3.Directory
Directory.GetParent("ccc").FullName
4.Path
Path.Combine(Directory.GetParent(mapPath).FullName, "Data");
5.using System.Xml.Serialization;
//T is generic
var se= new XmlSerializer(typeof(T));
using (var r = new System.IO.StreamReader("test.xml"))
{
result = (T)se.Deserialize(r);
}
评论
发表评论