Home

Funny looking syntax

Hi, I noticed this weird syntax that I'm not sure about. Are the mismatched curly brackets good syntax in the code sample below taken from the "C# 6.0 in a Nutshell / Chapter 8 / Project Strategies /Object Initializers? I tried removing the extra closing bracket from above the class definition and adding a closing curly bracket at the end of the class definition, but was given an error in LINQPad. If this is good syntax where do I read up about it?

var names = new[] { "Tom", "Dick", "Harry", "Mary", "Jay" }.AsQueryable(); IEnumerable<TempProjectionItem> temp = from n in names select new TempProjectionItem { Original = n, Vowelless = n.Replace ("a", "").Replace ("e", "").Replace ("i", "").Replace ("o", "").Replace ("u", "") }; temp.Dump(); } class TempProjectionItem { public string Original; // Original name public string Vowelless; // Vowel-stripped name

Comments

Sign In or Register to comment.