S
shapper
Hello,
I have the following class:
public class XmlSource {
public String Path { get; set; }
public XDocument Context { get; set; }
public XmlSource() { } // XmlSource
public XmlSource(String path) {
Path = path;
if (Context != null) Context = XDocument.Load(Path);
} // XmlSource
} // XmlSource
The problem is that if I define the Path not using the constructor I
will not have the Context defined.
Basically the functionality I would like for this class would be to be
able to define a Path and automatically the Context would be
created ... And it don't need to change unless Path is redefined.
Context is only supposed to be read by other classes so I can perform
queries with the file.
What would be the correct way to do this?
Does this make any sense?
Thanks,
Miguel
I have the following class:
public class XmlSource {
public String Path { get; set; }
public XDocument Context { get; set; }
public XmlSource() { } // XmlSource
public XmlSource(String path) {
Path = path;
if (Context != null) Context = XDocument.Load(Path);
} // XmlSource
} // XmlSource
The problem is that if I define the Path not using the constructor I
will not have the Context defined.
Basically the functionality I would like for this class would be to be
able to define a Path and automatically the Context would be
created ... And it don't need to change unless Path is redefined.
Context is only supposed to be read by other classes so I can perform
queries with the file.
What would be the correct way to do this?
Does this make any sense?
Thanks,
Miguel