yield return empty character literal

c#, char, linq, yield-return

Solution

You cannot `yield return nothing`. The solution would be to not yield return if it's a whitespace. Comment out that line and you should be good.

`''` is meaningless. The compiler will complain. There is no such thing as "no character".

Problem

I'm writing a Linq extension method, to make a p455w0rd from a string input. ``` public static IEnumerable<char> ToPasswordFormat(this IEnumerable<char> source) { var enumerator = source.GetEnumerator(); while (enumerator.MoveNext()) { switch((char)enumerator.Current) { case 'a': yield return '4'; break; case 'e': yield return '3'; break; case 'l': yield return '7'; break; case 'i': yield return '!'; break; case ' ': yield return ''; break; default: yield return (char)enumerator.Current; break; } } } ``` as you can see I want to remove spaces, but when I use `yield return '';` it gives me error `Empty character literal`. What is `''` and how can I return yield return nothing?

Original source

Related problems