c# - Use of an unassigned local string variable -


this question has answer here:

im trying set function read values xml file

the function following..

public string xmlreadvalue(string filepath, string element, string subelement)     {         xmldocument xml = new xmldocument();         xml.load(filepath);          xmlnodelist elements = xml.selectnodes("//" + element);         string valuee;          foreach (xmlnode elemente in elements)         {             valuee = elemente.selectsinglenode(subelement).innertext;         }         return valuee;     } 

when return value valuee says use of unassigned local variable 'valuee'

what doing wrong?

if elements empty never affect value valuee.

you should initialize :

string valuee = ""; 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -