Hello again; i try to save xml data from xml file. How can i do that? if i use below codes, XmlStream return null "throw null". How can do that?
my data:
<list>
<subscriber Type="Random">
<name>yusuf</name>
<surname>karatoprak</surname>
</subscriber>
</list>
public static XDocument GetRawsSnippetAsXDocuments()
{
Assembly assembly = Assembly.GetExecutingAssembly();
Stream xmlStream = assembly.GetManifestResourceStream("XlinqTest1.User.xml");
if (xmlStream == null)
{
throw new NullReferenceException("Hata!!!");
}
XDocument xmlDocument = XDocument.Load(XmlReader.Create(xmlStream));
return xmlDocument;
}
Main Program:
class Program
{
static void Main(string[] args)
{
XDocument document = XmlHelper.GetRawsSnippetAsXDocuments();
var listCount = document.Descendants("list").Count();
}
}