Error message

Error message

J-Rocks
Collaborator Collaborator
612 Views
4 Replies
Message 1 of 5

Error message

J-Rocks
Collaborator
Collaborator

 

Hello guys

 

I am facing a problem with my learning example , can anybody have a look at the codes and why I have that warning message and how to fix this ?

 

error.JPG

 

Here is the C# codes :

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary2
{
    class car
    {
        int id;
        string color;
        string model;

        public void usage(int id, string color, string model)
    {
        id = id;
        color = color;
        model = model;
    }
        public void showme()
        {
            Console.WriteLine("ID is : {0} \n Color is : {1} \n Model is : {2}", id, color,model);
        }
    }
    public class Class1
    {     
        static void main(string [] args)
        {
            car mycar = new car();
            mycar.usage(10, "Black", "BMW");
            mycar.showme();

        }
    }
}

 

Thanks in advance .

0 Likes
613 Views
4 Replies
Replies (4)
Message 2 of 5

SENL1362
Advisor
Advisor

This is a class project, which will be used as an extension to a (Main) program, such as AutoCAD.
Therefore this class cannot be started directly (from visual studio). Add AutoCAD to you're solution as a separate project, and set the property StartupProject

 

 

 

Screenshot_1.png

 

0 Likes
Message 3 of 5

J-Rocks
Collaborator
Collaborator

Thank you SENL for your reply .

 

Tthe codes that I posted above is not to work with Autocad and it is a C sharp Class , I tried to right click on the class but nothing is prompted as you did on Autocad plugin .

 

I tried to start a new C# class file and the right click on the class brings nothing , any other solution .

 

Thank you so much .

0 Likes
Message 4 of 5

SENL1362
Advisor
Advisor
Then this question does not belong to this forum.
However you can get this working by starting a new project of type Console Application, and past the code in that project.
0 Likes
Message 5 of 5

J-Rocks
Collaborator
Collaborator

I made a mistake by using the console system in Class file , sorry for confusion .

 

I copied and pasted the codes in console file but the program is prompted with anther error message that maybe related the main function .

 

Thanks

0 Likes