forum

home / developersection / forums / xml record value in mvc

XML Record Value in mvc

Anonymous User 2318 09-Nov-2014

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!


Updated on 10-Nov-2014

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By