------ 文章開始 ------
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.CompilerServices; namespace ConsoleApplication1 { class Node : Dictionary<object, dynamic> { public Node add_chain(object key, dynamic node) { this.Add(key, node); return this; } } class Program { struct TData1 { public string data1; } static void Main(string[] args) { var root = new Node( ).add_chain( "key1_level1", new Node( ).add_chain( "key1_level2", new TData1() { data1 = "test1" } ) ).add_chain( "key2_level1", 123456 ); Console.WriteLine(root["key1_level1"]["key1_level2"].data1); Console.WriteLine(root["key2_level1"]); Console.ReadKey(); } } } |
------ 文章結尾 ------
[複製網址]
[開新視窗]
[加到我的最愛]
[檢舉短網址]
[QR條碼]
服務條款 - 完全手冊 - 加入會員(免費) - 聯絡偶們 -
© PPT.cc