I have an .aspx page that I’m trying to render, but when I go to render characters, I get strange results.
<%= default(char) %>
Expands to the following in FF and Chrome, but not in IE:
�
Is there a way to ignore the value if it’s the null character? I’ve tried default(char).ToString(), but it seems have the same result. When there’s a null character, I just want to ignore it.
The default value for char is \0 or which is the equivalent of null but not actually a System.Null value, so the behaviour is as expected.
If you want to avoid that test for:
It’s important to remember to use single quotes for chars.
My worry is that this is a long way around doing this; what are you actually trying to do in your main code ?
Edit: To give a code sample to the fix paraphrased in my comment: