Conversion of C# classes to C++ Winforms

José Carlos 886 Reputation points
2023-02-22T10:14:02.09+00:00

Friends,

How to convert the class below, which is in C# to C++ Wniforms?

Obrigado.



Developer technologies | C++
Developer technologies | Visual Studio | Other
{count} votes

Accepted answer
  1. Minxin Yu 13,506 Reputation points Microsoft External Staff
    2023-02-24T01:42:25.2+00:00

    Hi, José Carlos Souza

    Try

    C++CLI:
    	public ref class Musica
    	{
    	public:
    		property String^ Arquivo
    		{
    			void  set(String^ value)
    			{
    				Arquivo = value;
    			}
    			String^ get()
    			{
    				return Arquivo;
    			}
    		}
    	public: Musica() { }
    	public: Musica(String^ arquivo)
    	{
    		Arquivo = arquivo;
    	}
    	};
    

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. José Carlos 886 Reputation points
    2023-02-23T13:37:13.9333333+00:00
    
    Hi friends.
    
    Here is the class code.
    
    
            public class Musica
            {
                public string Arquivo { get; set; }
                public Musica() { }
                public Musica(string arquivo)
                {
                    this.Arquivo = arquivo;
                }
            }
    
    0 comments No comments

  2. José Carlos 886 Reputation points
    2023-02-24T12:17:31.5533333+00:00

    Hi Minxin Yu,

    Worked perfectly. Thank you very much.

    Do you have a book or a good reference on C++ Winforms? I find very little on the Internet.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.