Class XmlSourceAndFile<T>
A class that combines an XML-serializable data object with its source file path.
public class XmlSourceAndFile<T> : ISourceFile where T : class, IMakeXmlSource
Type Parameters
TThe type of data object that can be serialized to XML
- Inheritance
-
XmlSourceAndFile<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
XmlSourceAndFile()
Initializes a new instance of the XmlSource class.
public XmlSourceAndFile()
XmlSourceAndFile(string, T)
Initializes a new instance of the XmlSource class with data and optional file path.
public XmlSourceAndFile(string file, T data)
Parameters
filestringOptional path to the XML source file
dataTThe data object to store
Properties
Data
Gets or sets the main data object being stored.
public T Data { get; set; }
Property Value
- T
SourceFile
Gets or sets the path to the source file.
public string SourceFile { get; set; }
Property Value
Methods
MakeXmlSourceWithRebaseFile(string)
Creates an XML representation of the data object with the file path rebased to the specified directory.
public XElement MakeXmlSourceWithRebaseFile(string baseDirectory)
Parameters
baseDirectorystringThe base directory for resolving relative paths
Returns
- XElement
An XML element representing the data object's state
Set(XmlSourceAndFile<T>)
Copies data from another XmlSource instance.
public void Set(XmlSourceAndFile<T> src)
Parameters
srcXmlSourceAndFile<T>The source XmlSource to copy from