AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

ObjectDataContractXMLSerializer<(Of <(<'T>)>)>..::..LoadFromFile Method

Deserializes an object from a file using DataContractSerializer.

Namespace:  AdvantageCMS.Core.Utils
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static T LoadFromFile(
	string path,
	string encoding
)

Parameters

path
Type: String
The file path to load from.
encoding
Type: String
The character encoding used in the file (default: "utf-8").

Return Value

The deserialized object of type T.

Examples


C#
ObjectDataContractXMLSerializer<UserProfile>.SaveToFile(profile, @"C:\Data\profile.xml");
UserProfile loaded = ObjectDataContractXMLSerializer<UserProfile>.LoadFromFile(@"C:\Data\profile.xml");