Design Pattern Examples
Overview of object-oriented design patterns
Composite_FileAccess.cs File Reference

The Composite_FileAccess static class as used in the Composite pattern. More...

Go to the source code of this file.

Classes

class  Composite_FileAccess
 Static class containing functions for accessing a hardcoded "file" and "directory" hierarchy. More...
 

Namespaces

namespace  DesignPatternExamples_csharp
 The namespace containing all Design Pattern Examples implemented in C#.
 

Detailed Description

The Composite_FileAccess static class as used in the Composite pattern.

This module contains the hardcoded example of a file/directory hierarchy. The example code calls Composite_FileAccess.GetEntry() with the path of of the file or directory. GetEntry() returns a FileDirEntry presenting the requested entry, with possible children (if the entry is a directory).

To simplify the example, the files and directories are hardcoded into a composite list so that GetEntry() only needs to return the entry from the composite list once it is found.

Definition in file Composite_FileAccess.cs.