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
Post a Comment