I cannot create new class in the project - Visual Studio

Asked

Viewed 127 times

0

I have a project where I created a new class

using System;
using Definitions;

namespace CommunicationCheck{

public class CommunicationCheck
{

    private message_struct Send;
    private message_struct Received;

    public CommunicationCheck()
    {
        this.Send = null;
        this.Received = null;

    }

    public MessageSent(message_struct msg)
    {
        this.Send = msg;
    }

    public bool CheckIncomingMessage(message_struct msg)
    {
        if (this.Send.header_byte == msg.header_byte)
        {
            this.Received = msg;
            return true;
        }
        else
            return false;
    }

    public message_struct GetSend()
    {
        return this.Send;
    }

    public message_struct GetReceived()
    {
        return this.Received;
    }
}

}

Dai when I try to add the namespace to another class I have the following message:

Mensagem de erro

Is it some syntax problem ? How to solve ?

  • Try changing the class name to a name other than the namespace, or even adding a reference if it’s a project other than the main one.

  • This class is within the same project?

  • Yes, he’s on the same project

1 answer

0


What happened was I created a class without adding it to my project. Just go to Project -> Add -> File and select the class.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.