Learning C#, ugh

Hi:
using the test code for GHT SCM20260D board and trying to modify it while learning C#. I am trying to add the line System.Diagnostics.Debug.WriteLine(“something”);
At the beginning of the module “using System.Diagnostics;” is declared but I get the error Debug does not contain a definition for WriteLine.

Looking at the object browser the definition seems to exist.
Very confused using C#, too bad VB does not work!

Can you send a screenshot or something to show what you mean? C#, like any programming language, has plenty of buzzwords and it’s not clear what you are asking.

Have you managed to load the test code onto the device prior to you modifying it?

your code should be composed of the following sections:

//these are using statements, they're tangentially related to #include statements in c or import statements in python
//if you use a using statement inside your class rather than the top of the file, it will do something else

using System;
using System.Collections;
using System.Diagnostics;
using System.Text;
using System.Threading;


namespace TestApp1 //namespaces in c# are logical collections of related classes and structs
{
    internal class Program 
    {
        static void Main() //Program.Main is the launch point for your program and will execute statements starting here
        {
            Debug.WriteLine("This is your error message");
        }
    }
}

Thanks for your reply. I am coming from the VB world… Writeline <> WriteLine
Oh well…

1 Like

I would recommend taking some time to learn C# - Tim Corey on youtube is probably my favorite, and his stuff is free.