zoukankan      html  css  js  c++  java
  • 文档操作

    1 AppDomain.CurrentDomain.BaseDirectory;

    获取当前项目所在的bin的debug目录下

    2 System.IO.Path.GetFullPath(filePath + "ShopModel.xml"

    获取绝对路径

    例子:

     1         /// <summary>
     2         /// 从配置文件中获取ShopModel
     3         /// </summary>
     4         /// <param name="ID"></param>
     5         /// <returns></returns>
     6         public Model.Base_ShopModel GetModelFromXML()
     7         {
     8             Model.Base_ShopModel model = new Model.Base_ShopModel();
     9             string filePath = AppDomain.CurrentDomain.BaseDirectory;
    10             string strXmlPath = System.IO.Path.GetFullPath(filePath + "ShopModel.xml");
    11             if (!File.Exists(strXmlPath)) 
    12             {
    13                 return null;
    14             }
    15             XmlDocument xml = new XmlDocument();
    16             xml.Load(strXmlPath);
    17             XmlNode xn = xml.SelectSingleNode("ShopModel");
    18             model.Shop_ID = xn.SelectSingleNode("ShopID").InnerText;
    19             model.ShopName = xn.SelectSingleNode("ShopName").InnerText;
    20             model.Province = xn.SelectSingleNode("Province").InnerText;
    21             model.City = xn.SelectSingleNode("City").InnerText;
    22             model.District = xn.SelectSingleNode("District").InnerText;
    23             model.ComputerTag = xn.SelectSingleNode("ComputerTag").InnerText;
    24             model.CompanyID = xn.SelectSingleNode("CompanyID").InnerText;
    25             model.LinkmanName = xn.SelectSingleNode("LinkmanName").InnerText;
    26             model.LinkmanPhone = xn.SelectSingleNode("LinkmanPhone").InnerText;
    27             model.Email = xn.SelectSingleNode("Email").InnerText;
    28             model.Remark = xn.SelectSingleNode("Remark").InnerText;
    29             return model;
    30         }
  • 相关阅读:
    【Android】页面切换ViewFlipper、ViewPager、ViewFlow
    【Android】9patch图片以及例子说明
    【Android】proguard混淆代码
    【iOS】ios6.0 UINavigationController支持屏幕自动旋转
    【Android】Notification官方文档归纳
    c++第一天
    c++第二天
    java第七天(布局管理器)
    Linux第一讲(韩顺平)
    java第四讲(类与对象)
  • 原文地址:https://www.cnblogs.com/YangBinChina/p/2986025.html
Copyright © 2011-2022 走看看