I want to get a
SPListItem from a
SPList where a field match a value. I have to ways to do it,
My code is:
... SPList list = Web.Lists["MyList"]; SPListItem item = (from SPListItem it in list.Items where it["A_Field"] == "A_Value" select it).First(); ....
... SPList list = Web.Lists["MyList"]; SPQuery query = new SPQuery(); query.Query = @" <Where><Eq> <FieldRef Name=""A_Field""/><Value Type=""Text"">A_Value</Value> </Eq></Where>"; SPListItem item = list.GetItems(query).Cast<SPListItem>().First(); ....
I have read in some blogs (like this) that there is a performance issue with
What is the better way to do it from scope of performance?