Javier Estades

Javier Estades

  • NA
  • 3
  • 522

Adding to a string list XMLArrayItem using Get Set

Oct 20 2016 11:24 AM
Hey guys I'm having a problem with a List Get Set on C# this is what I have
Anyone Please help me see where the problem is
The problem occurs on the get trying to add the selectedvalue
I'm thinking I wrote the get set wrong but I don't see it. I'm not used get sets with lists.
[Serializable]
public class ProcessObjectParts
{
/// <summary>
/// Object Part Lists
/// </summary>
[XmlArrayItem("Parts")]
public List<string> Parts { get; set; }
}
and the Get set goes like this:
get {
ProcessObjectParts parts = new ProcessObjectParts();
parts.Parts.Add(DropDownControl.SelectedValue);
parts.Parts.Add(DropDownControl.SelectedItem.Text);
return parts;
}
set {
var parts = GlobalHelper.DeserializeData<ProcessObjectParts>(value.ToString());
DropDownControl.SelectedValue = parts.Parts[0];
DropDownControl.SelectedItem.Text = parts.Parts[1];
ViewState[parts.Parts[0]] = value;
}

Answers (1)