Solved

Unsure how to handle Invalid token 'int' in class, struct, or interface member declaration error

Posted on 2006-06-21
2
705 Views
Last Modified: 2007-11-27
I am extremely new to C# and I get the following error with int highlighted at every line item:

Invalid token 'int' in class, struct, or interface member declaration

How do I fix the syntax below to work properly?
The following was taken from Sams Teach Yourself Microsoft Visual C#.NET 2003 in 24 hours on page 352.
Also - I hate the way my IDE in 2003 keeps trying to tab the braces once I press <ENTER> on a line item - it is not helping to much as I type in these examples.  Any suggestions is much appreciated - Stephen

using System;

namespace Class_Programming_Example
{
      /// <summary>
      /// Summary description for clsMyClass.
      /// </summary>
      public class clsMyClass
      {
      Private int m_intHeight;

      Public int Height
            {
                  get
                  {
                        return m_intHeight;
                  }
                  set
                  {  
                        m_intHeight = value;
                  }
            }
            public clsMyClass()
            {
            
                  //
                  // TODO: Add constructor logic here
                  //
            }
      }
}
0
Comment
Question by:stephenlecomptejr
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 16953466
Private, Public: replace with private, public.
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 250 total points
ID: 16954839
Remember that C# is case sensitive.  Almost all keywords begin lowercase.


As for the braces issue...you need to adjust your options.

Tools --> options --> TextEditor --> C# --> Formatting

You may want to uncheck options under indenting.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now