c# - Pass null as parameter in Regex.Replace -


i want replace value sql database in mail merging. seem getting error message in visual studio.

value cannot null. parameter name: replacement

when try

regex.replace(mergefieldsxml.innerxml,"«[^»]*" + wordtoreplace + "[^»]*»", securityelement.escape(mailmergedata[wordtoreplace ]),regexoptions.ignorecase); 

i wondering if possible ignore null value , continue replacement?

not not possible ignore null value , continue. if @ documentation method states argumentnullexception if of input, pattern, or replacement null.

you can either null check on values before calling method or using null-coalescing operator ?? inline.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -