Advertisement
Gillito

Untitled

Jul 23rd, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication60
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Folder currentFolder = new Folder("D:\\Folder1\\Folder2");
  14.             Folder parentFolder = new Folder("D:\\Folder1");
  15.             Folder childFolder = new Folder("D:\\Folder1\\Folder2\\Folder3");
  16.  
  17.             parentFolder.ChildFolder = currentFolder;
  18.             parentFolder.ParentFolder = null;
  19.             currentFolder.ChildFolder = childFolder;
  20.             currentFolder.ParentFolder = parentFolder;
  21.             childFolder.ParentFolder = currentFolder;
  22.             childFolder.ChildFolder = null;
  23.  
  24.             Console.WriteLine(currentFolder.Path);
  25.             Console.WriteLine(currentFolder.ParentFolder.ChildFolder.Path);
  26.         }
  27.     }
  28.  
  29.     class Folder
  30.     {
  31.         public Folder(string cur)
  32.         {
  33.             Path = cur;
  34.         }
  35.  
  36.         public string Path
  37.         {
  38.             get;
  39.             set;
  40.         }
  41.  
  42.         public Folder ParentFolder
  43.         {
  44.             get;
  45.             set;
  46.         }
  47.  
  48.         public Folder ChildFolder
  49.         {
  50.             get;
  51.             set;
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement