コード例 #1
0
 public MenuNode GetByNode(int[] path_, MenuNode current_ = null)
 {
     if (current_ == null)
     {
         return(GetByNode(path_, this.Root));
     }
     else
     {
         if (path_.Length > 0)
         {
             if (current_.Children.Count > path_[0])
             {
                 return(GetByNode(path_.Skip(1).ToArray(), current_.Children[path_[0]]));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             return(current_);
         }
     }
 }
コード例 #2
0
 // constructor as deserializer
 public Project(string fileName_)
 {
     using (FileStream fs = File.OpenRead(fileName_))
     {
         DataContractSerializer formatter = new DataContractSerializer(typeof(MenuNode));
         this._root     = formatter.ReadObject(fs) as MenuNode;
         this._fileName = fileName_;
     }
 }