Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions src/Chapter16/Listing16.01.SimpleQueryExpression.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_01
using System.Collections.ObjectModel;

#region INCLUDE
#region EXCLUDE
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16
{
#endregion
static public class CSharp
{
public static readonly ReadOnlyCollection<string> Keywords = new(
new string[]
{
"abstract","add*","alias*","as","ascending*",
"async*","await*","base","bool","break",
"by*","byte","case","catch","char","checked",
"class","const","continue","decimal","default",
"delegate","descending*","do","double","dynamic*",
"else","enum","equals*","event","explicit","extern",
"false","finally","fixed","float","for","foreach",
"from*","get*","global*","goto","group*","if","implicit",
"in","int","interface","internal","into*","is","join*",
"let*","lock","long", "nameof*", "namespace","new","nonnull*",
"null","object","on*","operator","orderby*","out","override",
"params","partial*","private","protected","public",
"readonly","ref","remove*","return","sbyte","sealed",
"select*","set*","short","sizeof","stackalloc","static",
"string","struct","switch","this","throw","true","try",
"typeof","uint","ulong","unchecked","unsafe","ushort",
"using","value*","var*","virtual","void","volatile"
,"when*","where*","while","yield*"
});
}
#region EXCLUDE
}

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16_01
{
using AddisonWesley.Michaelis.EssentialCSharp.Chapter16.Listing16;

#endregion
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -14,15 +51,20 @@ public static void Main()

private static void ShowContextualKeywords()
{
#region HIGHLIGHT
IEnumerable<string> selection =
from word in CSharp.Keywords
where !word.Contains('*')
select word;
#endregion

foreach(string keyword in selection)
foreach (string keyword in selection)
{
Console.Write(keyword + " ");
}
}
}
}
#region EXCLUDE
}
#endregion
#endregion
30 changes: 0 additions & 30 deletions src/Chapter16/Listing16.CSharp.cs

This file was deleted.