I have an xml file:
<profiles> <profile username="user4" fullname="Full Name" /> </profiles>
I am trying to retrive the value of the fullname, here is what I tried:
public List<string> GetFullName(string username) { List<Profile> list = null; try { list = (from t in ProfileList where t.UserName == username select t).FirstOrDefault(); } catch { } List<string> userFullName = new List<string>(); if (list != null) { foreach (Profile t in list) { userFullName.Find(t.FullName); } } return userFullName; }
FirstOrDefault gives an error!
Last updated:11/10/2014 12:53:19 AM
Anonymous User
I'd rather rewrite your code like this