Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main()
- {
- try {
- var upperFoo = MakeUppercase(null);
- Console.Write("Uppercased!");
- }
- catch (ArgumentNullException)
- {
- Console.Write("Exeption");
- }
- }
- public static IEnumerable<char> MakeUppercase(string foo)
- {
- if (foo == null)
- throw new ArgumentNullException("foo");
- foreach (var chr in foo)
- yield return Char.ToUpperInvariant(chr);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement