unassigned use of local variable q

  • Thread starter Thread starter Eric Sabine
  • Start date Start date
E

Eric Sabine

I just need to understand this bit. In some code, I had the following give
me an error at build time

XmlDocument xmlDoc;
xmlDoc.LoadXml(xmlString);

The error was "unassigned use of local variable" on the second line at
xmlDoc

I ammended the first line to include " = null" and it compiled fine. Could
someone more knowledgeable explain why the =null was explicitly required?

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top