0

So i have a chunk of code like this:

public List<DynamicBusinessObject> GetSearchResultList(Search search, List<CategoryAttribute> listCatAttrib, string sortBy, int startRow, int pageSize, [Optional, DefaultParameterValue("")] string state, [Optional, DefaultParameterValue("")] string condition, [Optional, DefaultParameterValue("")] string manufacturer)

I'd like to know how instead of a default value of "" (empty string) i can instead set it to null? Tried using DBNull.value but it didn't like that.

merk
  • 1,721
  • 5
  • 23
  • 39

2 Answers2

0

use the = null

public List<DynamicBusinessObject> GetSearchResultList(Search search, List<CategoryAttribute> listCatAttrib, string sortBy, int startRow, int pageSize, string state = null, string condition = null, string manufacturer = null)
0

It should be possible to simply replace the empty string with null like this:

[Optional, DefaultParameterValue(null)] string state
Øystein Kolsrud
  • 359
  • 2
  • 16