Running a c# subroutine using Visual Studio code

I'm not successfully running my subroutine in visual studio code. How can I run this is Visual Studio code?
using System;

namespace SelectSort
    class Program
   static void Main(long[] list, int min, int max) {
  int ic;

    long best_value;
    int best_j;
    for (ic = min; ic <= max - 1; ic++)
        best_value = list[ic];
        best_j = ic;
        for (var ji = ic + 1; ji <= max; ji++)
            if (list[ji] < best_value)
                best_value = list[ji];
                best_j = ji;
        list[best_j] = list[ic];
        list[ic] = best_value;


Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
VS Code is an editor. It won't run C# code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zachvaldezAuthor Commented:
ok, I created a new project. How can I call the subroutine using a button click?
Éric MoreauSenior .Net ConsultantCommented:
Are you using Visual Studio Code ( or the full IDE of Visual Studio?

If you are using the full VS, what type of project have you created? Console, Windows Forms, WPF, ASP.Net, ...
Choose an Exciting Career in Cybersecurity

Help prevent cyber-threats and provide solutions to safeguard our global digital economy. Earn your MS in Cybersecurity. WGU’s MSCSIA degree program was designed in collaboration with national intelligence organizations and IT industry leaders.

zachvaldezAuthor Commented:
I could not make this work using visual studio code with console.
Éric MoreauSenior .Net ConsultantCommented:
A console application cannot show a button. It does not have a UI.

And can you confirm that you really want to use the VSCode product (link above) for which I already said that you will not be able to run C# code.
NorieAnalyst Assistant Commented:
You can apparently use VS Code to run C#, see here.

Note I've tried this before but not with much luck - I gave up after a while, though I was probably doing something wrong.

It's probably easier to use Visual Studio, here's a link for the Community Edition.
Éric MoreauSenior .Net ConsultantCommented:
I knew you can add some plug in but it is not the purpose of VSCode especially that he is asking for a button click (which comes from a UI that is definitely not supported by VSCode). But I never had the answer to my question if was really using VSCode or a full VS IDE.
Chinmay PatelChief Technical NinjaCommented:
Hi zachvaldez,

VSCode works in a bid different fashion. Did you follow these setps described at:

I could debug your code following those steps, let me know if you run into any issues.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Visual Studio

From novice to tech pro — start learning today.