none
C to C# RRS feed

  • Question

  • Hi everybody.

    I have a C code and want to convert it to C#, then run it in another software.

    I do not know C and C#, that is why I cannot code it again in C#.

    It would be great if you share your knowledge with me and help me.

    Wednesday, September 11, 2019 7:38 AM

Answers

  • I have used TangibleSoftware's converters for years and I can say they are very good at getting your code converted from one language to another quickly. However they are still limited in what they do. Going from C/C++ to C# is going to require a lot of manual effort. C/C++ has a lot that will not translate to C# so the converter leaves them as todos for you. Furthermore the generated code won't compile so you're going to have to fix it up.

    The reality is that if you don't know either C or C# then no amount of automated support is going to help. You have manual work to do. If you don't know the source language then you have no way of knowing how to convert the semantics of something. If you don't know the target language then you have no way of fixing up the generated code. You're going to have to bring in someone who knows both languages.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, September 11, 2019 1:42 PM
    Moderator

All replies

  • Are you wanting a wide-ranging discussion?

    You set this to be a question, but you're not giving much to work with. 

     

    Are you saying you do not know either language?

    What do you need to do, exactly?

     

    If this is a genuine request, you'll have to show the code and explain what exactly you want to do. In all honesty, the normal course of action would be a good web search.

      

    So if you could spin this out a bit more it would go a long way.

     

     


    #PEJL
    Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

    Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!



    Wednesday, September 11, 2019 7:46 AM
    Moderator
  • Thanks a lot dear Peter.

    I am working with one software (SIMBA), and it is possible to develop some blocks based on our interest. I want to implement a new block in the software. The code that I received is in C, so I need to convert it to C#, then use it in the software.

    I am looking for a solution that I can convert the current code (C) to C#.

    Is there any online website or software?

    Because I am not able to write a code in C#.

    I hope I could make it clear.

    Wednesday, September 11, 2019 7:56 AM
  • Hi MehdiNodeh

    Thank you for posting here.

    You could download C++ to C# Converter to convert C to c#.

    Note:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, September 11, 2019 8:10 AM
    Moderator
  • Personally I would not recommend ANY software from a third party website.

    Some stats from Akamai:

    • 1 in every 99 emails is a phishing attack, using malicious links and attachments as the  main vector
    • 52% of successful email attacks get their victims to click within an hour — and 30% within  10 minutes
    • Nearly 1.5 million new phishing sites are created each month
    • 83% of InfoSec professionals experienced phishing attacks in 2018

    Only install software if you can get it through a reputable distribution system. like the App Stores or Visual Studio marketplace.

    Disclaimers are not a valid defence. Especially if you specifically recommend a named product. Disclaimers only have value if they were part of an earlier contract, or the reader agrees as part of an acceptance flow.

      

    WARNING: Computer viruses are transmitted through online software every day. The readers should check for the presence of viruses. Do not install software with elevated permissions or into a company or personal account that has a valuable identity, privileged access, or useful contacts. Microsoft accepts no liability for any damage caused by any virus transmitted by this software. In the event of any actions taken by the reader, the reader will be required to indemnify Microsoft against any claim for loss, or damage caused by any viruses, or otherwise.


    #PEJL
    Got any nice code? If you invest time in coding an elegant, novel or impressive answer on MSDN forums, why not copy it over to TechNet Wiki, for future generations to benefit from! You'll never get archived again, and you could win weekly awards!

    Have you got what it takes to become this month's TechNet Technical Guru? Join a long list of well known community big hitters, show your knowledge and prowess in your favoured technologies!






    Wednesday, September 11, 2019 8:32 AM
    Moderator
  • I have used TangibleSoftware's converters for years and I can say they are very good at getting your code converted from one language to another quickly. However they are still limited in what they do. Going from C/C++ to C# is going to require a lot of manual effort. C/C++ has a lot that will not translate to C# so the converter leaves them as todos for you. Furthermore the generated code won't compile so you're going to have to fix it up.

    The reality is that if you don't know either C or C# then no amount of automated support is going to help. You have manual work to do. If you don't know the source language then you have no way of knowing how to convert the semantics of something. If you don't know the target language then you have no way of fixing up the generated code. You're going to have to bring in someone who knows both languages.


    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, September 11, 2019 1:42 PM
    Moderator
  • Hi MehdiNodeh,

    Just FYI,
    C is a very low level language and it is a not object oriented programming ,on other hands

    C# is a high-level, object-oriented programming language, but its backbone is still clearly the C language.

    Thanks,

    Azam Sunasara

    Thursday, September 12, 2019 1:14 PM
  • Agreed. Context/semantics of the languages can be important, say the order to run initializers if explicit sequence of execution is to be expected.

    Blind translation when these matters will lead to bug.

    Friday, September 13, 2019 5:58 AM
    Answerer