List<DynamicBusinessObject> dbo = SearchController.Instance.GetSearchResultList(search, null, "date", startRow - 1, ucDataPager1.PageSize, state);
The above line of code is calling the GetSearchResultList method which up until now had 5 arguments.
I added a 6th argument but wanted to make this argument optional so that all the other pages that call this function don’t need to be updated just yet.
So i changed the function to look like this:
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public List<DynamicBusinessObject> GetSearchResultList(Search search, List<CategoryAttribute> listCatAttrib, string sortBy, int startRow, int pageSize, [Optional, DefaultParameterValue("")] string state)
{
StorageQuery qry = new QrySearchResult(
search.ID,
(listCatAttrib != null && listCatAttrib.Count > 0) ? listCatAttrib[0].Attribute.ID : -1,
(listCatAttrib != null && listCatAttrib.Count > 1) ? listCatAttrib[1].Attribute.ID : -1,
(listCatAttrib != null && listCatAttrib.Count > 2) ? listCatAttrib[2].Attribute.ID : -1,
1, sortBy, startRow, pageSize, state);
List<DynamicBusinessObject> list = BusinessObject.Search(qry);
return list;
}
However, when i try to build, it gives me the error that GetSearchResultList has no overload method and takes 5 arguments.
I also tried doing string state = “” instead of using [Optional]
Anyone got any ideas why it’s complaining about me not passing 6 arguments when i make the call if the 6th argument is optional?
You should be able to use:
One possible issue is that your project is targeting an older version of .NET. Check the project properties to make sure it is pointing at the correct version.