.net - T4 templates: any way to make ToStringWithCulture() convert null to string.Empty instead of throwing exception? -


when provide object t4 template nullable properties, unless explicitly write <#= obj.property ?? string.empty #> tostringwithculture(object objecttoconvert) method generated template throws argumentnullexception if property null. there neat or elegant way override behavior don't have pepper null coalescing on templates?

mnaoumov's solution. change base template class

public string tostringwithculture(object objecttoconvert) {     if (objecttoconvert == null)         return "";     ... } 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -