System.IO.FileSystemWatcher.RunningInstance.WatchedDirectory.Write C# (CSharp) Méthode

Write() private méthode

Write's this directory's path to the builder.
private Write ( StringBuilder builder, bool relativeToRoot ) : void
builder System.Text.StringBuilder The builder to which to write.
relativeToRoot bool /// true if the path should be relative to the root directory being watched. /// false if the path should be a full file system path, including that of /// the root directory being watched. ///
Résultat void
                private void Write(StringBuilder builder, bool relativeToRoot)
                {
                    // This method is recursive.  If we expect to see hierarchies
                    // so deep that it would cause us to overflow the stack, we could
                    // consider using an explicit stack object rather than recursion.
                    // This is unlikely, however, given typical directory names
                    // and max path limits.

                    // First append the parent's path
                    if (Parent != null)
                    {
                        Parent.Write(builder, relativeToRoot);
                        AppendSeparatorIfNeeded(builder);
                    }

                    // Then append ours.  In the case of the root directory
                    // being watched, we only append its name if the caller
                    // has asked for a full path.
                    if (Parent != null || !relativeToRoot)
                    {
                        builder.Append(Name);
                    }
                }
FileSystemWatcher.RunningInstance.WatchedDirectory