Pregunta

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.

¿Fue útil?

Solución

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)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top