Beispiel #1
0
 /// <summary> 写入数据到 XML </summary>
 /// <typeparam name="C"> 读取的数据类型 </typeparam>
 /// <param name="obj"> 将要写入的数据</param>
 /// <param name="fullpath"> 写 =入的文件路径 </param>
 /// <returns> 返回为 null 的时候写入成功 </returns>
 public static string WriteDataToXml <C>(this C obj, string fullpath) where C : class
 {
     try
     {
         XmlAction.Save(obj, fullpath);
         return(null);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Beispiel #2
0
 /// <summary> 写入数据到XML </summary>
 /// <typeparam name="S"> 写入的数据类型 </typeparam>
 /// <param name="obj"></param>
 /// <param name="fullpath"> 写入的路径 </param>
 /// <returns> 返回为 null 的时候写入成功 </returns>
 public static string WriteStructToXml <S>(this S obj, string fullpath) where S : struct
 {
     try
     {
         XmlAction.Save(obj, fullpath);
         return(null);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }