I have an xml file:
<profiles><profileusername="user4"fullname="Full Name"/></profiles>
I am trying to retrive the value of the fullname, here is what I tried:
publicList<string>GetFullName(string username){List<Profile> list =null;try{ list =(from t inProfileListwhere t.UserName== username select t).FirstOrDefault();}catch{}List<string> userFullName =newList<string>();if(list !=null){foreach(Profile t in list){ userFullName.Find(t.FullName);}}return userFullName;}
FirstOrDefault gives an error!
Anonymous User
10-Nov-2014I'd rather rewrite your code like this