How do I add a member to a class?

I'm just starting to learn C# in VS 2005, and I'm using a book written for 2003 (which is always good for a few problems). I'm trying to add a member to a class. The book isn't even close, so I'm ignoring that, but the docs that come with Visual Studio aren't helping at all. They give me 3 ways to add a member, but don't explain how to get to any of them. I've only found one - a button on the toolbar for the class details window, from which I'm supposed to be able to add a member, but the button is inactive, and there's no indication why.

This is the simplest of demo projects, and there's no way I should be having this much trouble, even if I just use the Microsoft docs. But the docs just go round and round, never defining anything. Any help with this




Answer this question

How do I add a member to a class?

  • Thomas Skovsende

    Does "class designer" mean a class diagram Is that actually the only way to add a method The docs mention 3 ways to add a method, but they all seem to say at one point "right click on the class diagram", which is really one way, isn't it



  • DanCR82

    Yeap class designer means Class Diagram.

    Another way is if you open the corresponding class coding window and if you write a new method the class diagram will automatically updated. This two way I know. I will look for the other way soon and will give you the feedback.

    Regards,



  • Brian MB

    Yeah, I finally gave up and started typing in code direct. It produces the same results and is probably faster, but I hate thinking that I've missed a whole section of the IDE.



  • Hussein Ahmad

    And I meant method, not member. Jeez.



  • Billeter

    When you are in a learning stage, don't generate code but type it!

    You need to learn the syntax very well and by writing it yourself you will learn and understand it much faster then using code generation!



  • deadlock07

    If you are using class designer, then in the designer window right click the class where you want to add your method. In the context menu displayed you will get Add menu. There u will find Method, Properties etc.

  • How do I add a member to a class?