예제 #1
0
        public int GetNumberOfLines()
        {
            if (m_realFileRepository != null)
            {
                m_realFileRepository = new RealFolderRepository(m_path);
            }

            return(m_realFileRepository.GetNumberOfLines());
        }
예제 #2
0
        public bool IsExist()
        {
            if (m_realFileRepository == null)
            {
                m_realFileRepository = new RealFolderRepository(m_path);
            }

            return(m_realFileRepository.IsExist());
        }
예제 #3
0
        static void Main(string[] args)
        {
            //A large folder (on my computer).
            const string path = @"C:\Program Files\MATLAB";

            //Using the RealFileRepository: creation take long time
            //(not necessary if we just want to know if exist)
            var realFileRepository = new RealFolderRepository(path);

            //Using the Proxy:
            var lazeFolderRepositoryProxy = new LazyFolderRepositoryProxy(path);

            if (lazeFolderRepositoryProxy.IsExist())
            {
                Console.WriteLine("The Folder Exist");
            }
        }