Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Am I going stone mad ? MSDN

Options
  • 18-03-2008 5:05pm
    #1
    Registered Users Posts: 221 ✭✭


    Hi All,

    During my time (well 3rd and 4th) I did most of my programming in Java. During this time I became accustomed to using the java class library, I've always found it easy to use well laid out.

    Now I'm out of college and using Visual studio. Now in general I like visual studio and coming from a java background I'm taking to it quite quickly however I have a issue when it comes to the class library.

    I find it a bit cluttered but my real problem is this I'm using System.io.Streamwriter, now I'm creating an instance of streamwriter and passing a parameter (a destination file) to the constructor, fine. The problem is I went to class reference section for this class to see what variable was being used to hold the parameter and i can't find it.

    It has a section for constructors and each one gets it's own sub section but I've gone tot eh right section and all it does is tell me what the constructor dose

    Am I missing something?

    - Elfman


Comments

  • Closed Accounts Posts: 81 ✭✭dzy


    Elfman wrote: »
    ...to see what variable was being used to hold the parameter and i can't find it.

    Sorry :( You lost me here. What do you mean by "what variable was being used to hold the parameter"?

    I hear you though. I find the site very frustrating to use. There are not enough examples on how to use the framework. I mostly end up going to external sites to read some tutorials.


  • Registered Users Posts: 2,426 ✭✭✭ressem


    There isn't a member variable in StreamWriter which directly provides access to the filename.

    Reason is that the underlying stream could be lots of things other than a file.

    So what you can do is...

    1. Confirm that the type of the BaseStream is of type System.IO.FileStream
    2. Assuming that is the case, you can cast the BaseStream to a filestream. Then you can use the "Name" member variable to get the filename underlying the stream.

    Something like
    if (appStreamwriter.BaseStream.GetType() == typeof( System.IO.FileStream) )
    {
        FileStream fs = (FileStream)appStreamwriter.BaseStream;
        Console.WriteLine(fs.Name);
    }
    


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Small bit off topic but I found the free version of VS a bit limiting and didn't give all the data that you needed all the time. Got the full MSDN license recently and it is much better.

    Although I still prefer Java. ;)


  • Registered Users Posts: 2,426 ✭✭✭ressem


    Just using the Object Browser in VS might be quicker (Ctrl- Alt- J)

    But I'm guessing that you're using the website.
    If you use the breadcrumb trail at the top of the page to navigate for the field/members etc, you might find it easier.

    That's the bit that goes
    MSDN > MSDN Library > Net Development > ...
    > System.IO.Namespace > StreamWriter Class

    Holding the mouse pointer over an entry will list the possible subsections (Member, Constructor, Fields, Method, Properties)


Advertisement