《C#本质论》读书笔记(15)使用查询表达式的LINQ

时间:2021-11-28 03:26:42

private static void ShowContextualKeywords1()  

{  

    IEnumerable<string> selection = from word in Keywords  

                                    where !word.Contains(‘*‘)  

                                    select word;  

  

    foreach (string keyword in selection)  

    {  

        Console.Write(" " + keyword);  

    }  

}  

  

private static string[] Keywords = {  

                                       "abstract""add*""alias*""as""ascending*""base",  

                                       "bool""break""by*""byte""case""catch""char",  

                                       "checked""class""const""continue""decimal",  

                                       "default""delegate""descending*""do""double",  

                                       "dynamic*""else""enum""event""equals*",  

                                       "explicit""extern""false""finally""fixed",  

                                       "from*""float""for""foreach""get*""global*",  

                                       "group*""goto""if""implicit""in""int",