Is Same Directory - CSharp File IO

CSharp examples for File IO:Directory

Description

Is Same Directory

Demo Code


using System.Text;
using System.Linq;
using System.IO;/*  w  w  w .  jav a 2s .  c  o  m*/
using System.Collections.Generic;
using System.Collections;
using System;

public class Main{
        static public bool IsSameDirectory(this DirectoryInfo info, DirectoryInfo other)
        {
            return (
                0 == String.Compare(
                    System.IO.Path.GetFullPath(info.FullName).TrimEnd('\\'),
                    System.IO.Path.GetFullPath(other.FullName).TrimEnd('\\'),
                    StringComparison.InvariantCultureIgnoreCase))
                ;
        }
}

Related Tutorials