■ XmlSerializer 클래스 : 객체 구하기

----------------------------------------------------------------------------------------------------

using System;

using System.IO;

using System.Xml.Serialization;

 

#region 객체 구하기 - GetObject(xml, objectType)

 

/// <summary>

/// 객체 구하기

/// </summary>

/// <param name="xml">XML</param>

/// <param name="objectType">객체 타입</param>

/// <returns>객체</returns>

public object GetObject(string xml, Type objectType)

{

    XmlSerializer xmlSerializer = new XmlSerializer(objectType);

 

    object targetObject = xmlSerializer.Deserialize(new StringReader(xml));

 

    return targetObject;

}

 

#endregion

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG