unable to create object of type 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 and use properties of directory class.

    below is the code snippet

    public void FullDirList(object dir)
    //cast dir object to object of type
    Directory d=new directory(dir);   
    Directory d = new Directory();

    Tuesday, July 9, 2013 9:47 AM


  • 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 ?


    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