Class View Add Method / Property Wizard

Hello!

This is my first time using Visual C# IDE, - Express edition.

I would like to find out if the C# Express edition Wizards (or are they called templates) are available I see where one can add the code, but this is the error after typing in the code.  The build fails as expected

Error 1 Expected class, delegate, enum, interface, or struct ...

public long Add(long val1, long val2)

{

}

public long x;

The (underlined red) error is the return type or the type

My project is a class library - DLL. I do not see the Add Method or Add Property in the Class View - right click on the Class1 to get the context menu. Several tutorials show this capability

Are there add in templates or is this wizard feature available in upward editions.

I hope this is clear.



Answer this question

Class View Add Method / Property Wizard

  • Sameer.V

    I *think* you're talking about the snippets feature.  For example, type for and hit tab twice, and you'll be walked through created a for loop.

    I've never seen an add method or add property item in the class view, excepting in C++, where these things need to be added in more than one place.  Apart from the fact that your Add method does not return anything, I can't see any reason for it not to compile, unless it was not within a namespace or not within a class ( it needs to be in both ).

    There is no reason in the world to have the feature you're looking at, it's always going to be quicker to just type the method in, as C# does not have header files.

     



  • mullr

    Hi Javalier -

    That sample looks like a VS2003 project and yes, it's out of date with the current IDE.  We no longer have an add method/property option from class view.  However, we now have the class designer that will allow you to do something similar, but unfortunately, it doesn't come with C# Express.

    As cgraus suggested, you might want to try using snippets.  To add a property, type "prop" then hit [Tab] to expand it.  You may need to hit [Tab] [Tab] -- the first tab dismisses the completion list, the second expands the snippet.

    HTH,
    Karen



  • Nathan

    Let me work on the snippets concept. This URL is interesting and basis for discussion. See pages 4 - 6 which clearly shows the Add Method menu item. If this is an earlier VC# IDE is one possibility.

    http://www.c-sharpcorner.com/2/pr12.asp

    Thank you


  • Class View Add Method / Property Wizard