none
unable to create object of type system.io.directory from system.object RRS feed

  • Question

  • What is the workaround for the mentioned issue? I dont get casting error,but m not able to convert dir of type system.object to system.io.directory and use properties of directory class.

    below is the code snippet

    public void FullDirList(object dir)
    { 
    //cast dir object to object of type system.io.directory
    Directory d=new directory(dir);   
    Directory d = new Directory();
    d=(Directory)dir; 
    }

    Tuesday, July 9, 2013 9:47 AM

Answers

  • Hi,

    which properties do you mean? The System.IO.Directory class does not contain any properties. Maybe you want to try to use System.IO.DirectoryInfo class instead.

    Also, what type should  object dir represent ?


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    My Forum Threads

    Tuesday, July 9, 2013 10:22 AM