Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Whats wrong with my code?

$
0
0

Hi, I am very new to this and just started a class on C#. I made a code, but Visual Studio claims there are some errors, errors I dont know how to solve. This is the furthest I got, all other attempts have generated more errors than these 2.

I hope I posted this in the correct forum, sorry if I posted it in the wrong section.

My project is to make a method which is only accesable from within the own class, An integer that input parameter, a text string as the return value and at last I am gonna return the text together with the input parameter.

So here is my code:

namespace metodtesting
{
    class Program
    {
        static void Main(string[] args);
        {  <--- first error
            class Test
            {
                public void PrintSomeThing(int nr)
                {
                    Console.WriteLine(new Method1(nr));
                }
                private String Method1(int nr)
                {
                    Convert.ToString("Some text " + nr.toString);
                }

            }
        }
    }
} <--- second error

And the errors I get are these:

1. Invalid token '{' in class, struct. or interface member declaration

2. Type or namespace definition, or en-of-file expected.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>