<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 如何:創建嵌套組(C# 編程指南) 下面的示例演示如何在 LINQ 查詢表達式中創建嵌套組。對根據學生年級創建的每個組,將根據每個人的姓名進一步劃分為小組。 ``` public void QueryNestedGroups() { var queryNestedGroups = from student in students group student by student.Year into newGroup1 from newGroup2 in (from student in newGroup1 group student by student.LastName) group newGroup2 by newGroup1.Key; // Three nested foreach loops are required to iterate // over all elements of a grouped group. Hover the mouse // cursor over the iteration variables to see their actual type. foreach (var outerGroup in queryNestedGroups) { Console.WriteLine("DataClass.Student Level = {0}", outerGroup.Key); foreach (var innerGroup in outerGroup) { Console.WriteLine("\tNames that begin with: {0}", innerGroup.Key); foreach (var innerGroupElement in innerGroup) { Console.WriteLine("\t\t{0} {1}", innerGroupElement.LastName, innerGroupElement.FirstName); } } } } /* Output: DataClass.Student Level = SecondYear Names that begin with: Adams Adams Terry Names that begin with: Garcia Garcia Hugo Names that begin with: Omelchenko Omelchenko Svetlana DataClass.Student Level = ThirdYear Names that begin with: Fakhouri Fakhouri Fadi Names that begin with: Garcia Garcia Debra Names that begin with: Tucker Tucker Lance DataClass.Student Level = FirstYear Names that begin with: Feng Feng Hanying Names that begin with: Mortensen Mortensen Sven Names that begin with: Tucker Tucker Michael DataClass.Student Level = FourthYear Names that begin with: Garcia Garcia Cesar Names that begin with: O'Donnell O'Donnell Claire Names that begin with: Zabokritski Zabokritski Eugene */ ``` 請注意,需要使用三個嵌套的 **foreach** 循環來循環訪問嵌套組的內部元素。 ## 編譯代碼 此示例包含對[如何:查詢對象集合(C# 編程指南)](https://msdn.microsoft.com/zh-cn/library/bb907066.aspx)內示例應用程序中定義的對象的引用。若要編譯和運行此方法,請將它粘貼到該應用程序的 StudentClass 類中,并且在 Main 方法中添加對它的調用。 在改寫此方法以適合您自己的應用程序時,請記住 LINQ 需要 .NET Framework 3.5 版,并且項目必須包含一個對 System.Core.dll 的引用和一條針對 System.Linq 的 using 指令。LINQ to SQL、LINQ to XML 和 LINQ to DataSet 類型需要其他 using 指令和引用。有關更多信息,請參見 [How to: Create a LINQ Project](https://msdn.microsoft.com/zh-cn/library/bb546156.aspx)。 ## 請參閱 [LINQ 查詢表達式(C# 編程指南)](https://msdn.microsoft.com/zh-cn/library/bb397676.aspx)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看