I'm making a web service call and getting data back that I am adding to a list. No problems doing that. My remedyinfo
list has content that I can verify with break points in VS.
I cannot seem to figure out how to search the list for a value that matches a new variable, for instance I want to find if incidentID
is equal to "INC000000001".
I've tried var foundItem = remedyinfo.Contains("searchvalue")
but it always returns false
.
I've tried the LINQ queries as suggested in other post:
var foundItem = myArray.SingleOrDefault(item => item.intProperty == someValue);
What I do notice is that the sample refers to comparing item.intProperty == somevalue)
should work, I am not able to get any reference after item.
, only suggested Equals
, GetType
, GetHashCode
and ToString
. So, I cannot reference item.incidentID
for example.
Any guidance is greatly appreciated.
var remedyinfo = new List<object> { };
remedyinfo.Add(new IncidentItem()
{
assignedgroup = assignedgroup,
incidentID = incidentID,
submitdate = offsetDate.ToString(),
priority = priority,
status = status,
assignee = assignee,
summarydesc = summarydesc,
notes = notes
});
[Serializable]
public class IncidentItem
{
public string assignedgroup { get; set; }
public string incidentID { get; set; }
public string submitdate { get; set; }
public string priority { get; set; }
public string status { get; set; }
public string assignee { get; set; }
public string summarydesc { get; set; }
public string notes { get; set; }
}