diff --git a/OSS.Common/Extention/ConvertExtention.cs b/OSS.Common/Extention/ConvertExtention.cs
index 0fab1c4..fe59641 100644
--- a/OSS.Common/Extention/ConvertExtention.cs
+++ b/OSS.Common/Extention/ConvertExtention.cs
@@ -13,10 +13,7 @@
#endregion
using System;
using System.Collections.Generic;
-using System.IO;
using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
namespace OSS.Common.Extention
{
@@ -564,82 +561,4 @@ namespace OSS.Common.Extention
}
}
-
-
- ///
- /// xml 转化扩展
- ///
- public static class XmlConvertExtention
- {
- ///
- /// 对象序列化成xml字符串
- ///
- ///
- ///
- public static string SerializeToXml(this object t)
- {
- string result = string.Empty;
- MemoryStream stream = null;
- StreamReader streamReader = null;
- try
- {
- var serializer = new XmlSerializer(t.GetType());
-
- stream = new MemoryStream();
- serializer.Serialize(stream, t);
-
- stream.Position = 0;
- streamReader = new StreamReader(stream);
- result = streamReader.ReadToEnd();
- }
- finally
- {
- streamReader?.Dispose();
- stream?.Dispose();
- }
- return result;
- }
-
- ///
- /// xml字符串转化到对象
- ///
- ///
- ///
- ///
- public static TT DeserializeXml(this string xml)
- where TT:class
- {
- return DeserializeXml(xml, typeof(TT)) as TT;
- }
-
- ///
- /// xml字符串转化到对象
- ///
- ///
- ///
- public static object DeserializeXml(this string xml,Type type)
- {
- object result = null;
- MemoryStream stream = null;
- StreamWriter writer = null;
- try
- {
- stream = new MemoryStream();
-
- writer = new StreamWriter(stream);
- writer.Write(xml);
- writer.Flush();
-
- stream.Position = 0;
- var deSer = new XmlSerializer(type);
- result = deSer.Deserialize(stream);
- }
- finally
- {
- writer?.Dispose();
- stream?.Dispose();
- }
- return result;
- }
- }
}
diff --git a/OSS.Common/Extention/XmlExtention.cs b/OSS.Common/Extention/XmlExtention.cs
new file mode 100644
index 0000000..27f7136
--- /dev/null
+++ b/OSS.Common/Extention/XmlExtention.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace OSS.Common.Extention
+{
+ ///
+ /// xml 转化扩展
+ ///
+ public static class XmlConvertExtention
+ {
+ ///
+ /// 对象序列化成xml字符串
+ ///
+ ///
+ ///
+ public static string SerializeToXml(this object t)
+ {
+ string result = string.Empty;
+ MemoryStream stream = null;
+ StreamReader streamReader = null;
+ try
+ {
+ var serializer = new XmlSerializer(t.GetType());
+
+ stream = new MemoryStream();
+ serializer.Serialize(stream, t);
+
+ stream.Position = 0;
+ streamReader = new StreamReader(stream);
+ result = streamReader.ReadToEnd();
+ }
+ finally
+ {
+ streamReader?.Dispose();
+ stream?.Dispose();
+ }
+ return result;
+ }
+
+ ///
+ /// xml字符串转化到对象
+ ///
+ ///
+ ///
+ ///
+ public static TT DeserializeXml(this string xml)
+ where TT : class
+ {
+ return DeserializeXml(xml, typeof(TT)) as TT;
+ }
+
+ ///
+ /// xml字符串转化到对象
+ ///
+ ///
+ ///
+ public static object DeserializeXml(this string xml, Type type)
+ {
+ object result = null;
+ MemoryStream stream = null;
+ StreamWriter writer = null;
+ try
+ {
+ stream = new MemoryStream();
+
+ writer = new StreamWriter(stream);
+ writer.Write(xml);
+ writer.Flush();
+
+ stream.Position = 0;
+ var deSer = new XmlSerializer(type);
+ result = deSer.Deserialize(stream);
+ }
+ finally
+ {
+ writer?.Dispose();
+ stream?.Dispose();
+ }
+ return result;
+ }
+ }
+}
diff --git a/OSS.Common/OSS.Common.csproj b/OSS.Common/OSS.Common.csproj
index 14231fe..fcf128d 100644
--- a/OSS.Common/OSS.Common.csproj
+++ b/OSS.Common/OSS.Common.csproj
@@ -58,6 +58,7 @@
+