SerializeExtendToXmlString Method
轉換Xml字串
Namespace: eBizprise.FrameworkAssembly: eBizprise.Framework.SerializeHelper (in eBizprise.Framework.SerializeHelper.dll) Version: 26.0.0.0+8b857ad8115790502a00f482082d0feffe7e9c92
public static string ToXmlString(
this Object sourceObject
)
- sourceObject Object
- 物件
StringstringIn Visual Basic and C#, you can call this method as an instance method on any object of type
Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
將指定類型的物件轉為Xml字串格式回傳
TestClass testClass = new TestClass() { DecimalColumn = (decimal)3.3, IntColumn = 2, StringColumn = "Data" };
string testClassXmlString = SerializeHelper.ToXmlString(testClass);
///
/// 測試類別
///
class TestClass
{
///
/// 文字欄位
///
public string StringColumn { get; set; }
///
/// 整數欄位
///
public int IntColumn { get; set; }
///
/// 數字欄位
///
public decimal DecimalColumn { get; set; }
///
/// 二進位欄位
///
public byte[] ByteColumn { get; set; }
}
| Date | Version | Description |
|---|
| 2020/06/18 | 1.0.5.0 | 初版 |
| 2025/09/19 | 25.0.0.0 | 彙整2025年度初版 |