/// <summary> /// Gets the first item from the list of items matched by the query. /// </summary> /// <param name="assertMaxOne">Throw an exception if there is more than one /// item in the list.</param> /// <param name="assertMinOne">Throw an exception if there is less than one /// item in the list.</param> /// <returns>The first item in the list of items matched by the query.</returns> public SC.Data.Items.Item GetSingleItem(bool assertMaxOne, bool assertMinOne) { if (assertMaxOne) { Assert.IsFalse(this.Items.Length > 1, "this.Items.Length > 1"); } if (assertMinOne) { Assert.IsFalse(this.Items.Length < 1, "this.Items.Length < 1"); } return(this.Items[0]); }