开发者

Getting " type of namespace definition, or end-of-file expected error"

开发者 https://www.devze.com 2023-04-10 10:24 出处:网络
using System; namespace test { public class multiplying { public static void Main( string[] args); { //getting invalid \'{\' token here
using System;

namespace test

{
    public class multiplying
    {   
        public static void Main( string[] args);
        { //getting invalid '{' token here 
            int number1;
            int number2;
            int total;

        }
    }
} // getting type of namespace definition, or end-of-file expected error here 

The programme isn't f开发者_如何学Goinished obviously but when I write more in I just get more errors so there must be something wrong here but I don't know what.


public static void Main( string[] args);

should be

public static void Main( string[] args)


You have an extra semi-colon here : public static void Main( string[] args);


public static void Main( string[] args);

You have an extra ; there.


I'm not that familiar with C#, but I think this is your problem:

    public static void Main( string[] args);
    { //getting invalid '{' token here 

; is ending the declaration, so the { is considered completely separate (and don't make sense without a function signature coming first. Try changing it to this:

    public static void Main( string[] args)
    {


You have a ; after the closing bracket of the argument list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号