• 0

Help with Visual Studio 2005 > 2022


Question

My son asked if I could teach him some programming. I studied programming in university and it was mostly C#. I briefly did that after I graduated but then went into BI career and can't remember much about C# or VS.

I have all my material from school and thought my son can start with the Hello World console application like I did. I then downloaded VS2022 and created a new project but I guess a lot has changed.

Could someone explain this to me.

Back in the day when I created new console application I got this.

using System;
using System.Collections.Generic;
using System.Text;

namespace Hello
{
    class Program
    {
        static void Main(string[] args)
        {
            
        }
    }
}

 

Now with VS2022

I get this on new project.

Console.WriteLine("Hello world!");

 

Why no using, namespace, class etc?

Link to comment
https://www.neowin.net/forum/topic/1425371-help-with-visual-studio-2005-2022/
Share on other sites

9 answers to this question

Recommended Posts

  • 1

Another good resource is W3Schools C# Tutorial, may be slightly out of date but should get him started.  

At the very core C# has evolved but a lot of the core language features are still the same as 1.0.  I personally dislike the Top-Level Statements feature but that's also coming from my background with C/C++.

Now what's jarring is the change from VB6 to VB.Net...

  • 0
On 30/01/2023 at 21:08, Joni_78 said:

My son asked if I could teach him some programming. I studied programming in university and it was mostly C#. I briefly did that after I graduated but then went into BI career and can't remember much about C# or VS.

I had all my material from school and thought my son can start with the Hello World console application like I did. I then downloaded VS2022 and created a new project but I guess a lot has changed.

Could someone explain this to me.

Back in the day when I created new console application I got this.

Exactly, C# has changed (evolved?) a lot. You can read about this feature here. It is called Implicit Using

  • 0

In addition to implicit using it's also top-level statements, you can check "Do not use top-level statements" when you create a project in VS2022 and the template will generate the more familiar namespace/class/main method declaration.

  • Like 2
  • Thanks 1
  • 0
On 30/01/2023 at 21:24, Joni_78 said:

Thanks. I guess i have a lot to catch up.

A lot of things have changed and a lot of new things have come on the scene. The three most important ones added in these years are  (IMHO) Generics, the Linq libraries and the async/await paradigm. Only these innovations have made a huge leap forward to the language and support frameworks. Then, of course, there is the switch from NET Framework to NET.Core and now just NET6.0/7.0 that allows to write programs also for Mac and Linux. The mobile world has entered in Visual Studio with Xamarin. OK, enough, there are thousands changes. It is not possible to make an exaustive list here.

  • 0
On 30/01/2023 at 18:54, Matthew S. said:

Another good resource is W3Schools C# Tutorial, may be slightly out of date but should get him started.  

At the very core C# has evolved but a lot of the core language features are still the same as 1.0.  I personally dislike the Top-Level Statements feature but that's also coming from my background with C/C++.

Now what's jarring is the change from VB6 to VB.Net...

That change made me give up on VB. I LOVED just banging projects out in 6, .net killed the fun of it for me. I moved onto webdev.

  • 0

In Visual Studio 2022, the default template for a new console application has been simplified to provide a more streamlined and beginner-friendly experience. The new template removes some of the unnecessary code that was present in earlier versions, while still allowing you to write and run your program effectively.

The simplified template in VS2022 focuses on the essential part of a console application: printing "Hello world!" to the console output. The line of code you see,

Console.WriteLine("Hello world!");

, accomplishes this by using the Console class from the System namespace.

Although the previous template included a using statement, a namespace declaration, and a class definition, those are not required for a basic console application. In the simplified template, Visual Studio takes care of the necessary behind-the-scenes setup so that you can quickly start writing and executing your code.

If you wish to introduce your son to programming using the previous template structure you mentioned, you can still create a new console application project and manually add the code. Simply remove the default line Console.WriteLine("Hello world!"); and replace it with the code you provided:

using System;
using System.Collections.Generic;
using System.Text;

namespace Hello
{
    class Program
    {
        static void Main(string[] args)
        {
            
        }
    }
}

By doing this, you can replicate the structure you were familiar with and teach your son the traditional way of writing a console application. As per this Power BI training resource, it is very easy to get it done.

Remember that while the default template has changed, the core concepts and principles of programming remain the same. The change in the template is primarily aimed at making it more accessible and less overwhelming for beginners.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Well I've done a grand total of nothing, and it now clocks between 2010mhz and 1995mhz (stock is 1710mhz) and hovers around 80c, warmer than it used to, but tolerable clocks seem to have returned. Thanks for all the advice on this thread. Will review the evidence and make a choice.
    • Audacious 4.6.1 by Razvan Serea Audacious is a lightweight, open-source audio player that emphasizes simplicity, performance, and sound quality. Designed for Linux, Windows, and macOS, it supports a wide range of audio formats, internet radio streaming, and playlist management. Users can customize the interface with Winamp-style skins or modern themes, making it flexible for different preferences. Audacious also includes an equalizer, advanced audio effects, and a plugin system for extending functionality. Its low resource usage makes it especially suitable for older computers or users who value efficiency without sacrificing playback quality. Audacious key features: High audio quality – delivers clean, gapless playback with minimal distortion. Wide format support – plays MP3, FLAC, Ogg Vorbis, AAC, WAV, WMA, and more. Internet radio streaming – supports Shoutcast, Icecast, and other online streams. Winamp skin support – classic, nostalgic look for users who prefer the old-school style. Modern GTK-based interface – clean, simple UI with a more modern feel. Customizable themes – change appearance through skins and themes. Advanced playlist management – organize, save, and edit playlists with ease. Equalizer – fine-tune audio output with a built-in graphical equalizer. Audio effects – built-in DSP options like crossfade, replay gain, and more. Plugin system – extend functionality with additional components. File metadata support – displays and organizes music based on tags. Drag-and-drop support – quickly add songs or playlists. Global hotkey support – control playback without switching windows. Bit-perfect output modes – bypass system mixers for pure audio output. ReplayGain support – normalizes track loudness automatically. Cue sheet support – play entire albums from a single audio file with .cue. MPRIS2 integration – integrates with Linux desktop environments for media controls. Advanced resampling options – adjust playback quality with different resampler settings. Gapless playback – seamless transition between tracks encoded properly. Crossfade plugin – blend one song into the next smoothly. Last.fm scrobbling plugin – track listening history online. Remote control support – control Audacious via command-line or scripts. Lyrics plugin – display song lyrics if available. Alarm / timer plugin – start or stop playback at set times. SOX resampler plugin – high-quality resampling for audiophiles. Spectrum analyzer / visualization plugins – visual feedback while playing music. Headphone crossfeed effect – simulates speaker listening for headphones. Customizable buffer size – tweak latency and playback smoothness. Audacious 4.6.1 changelog: Use XDG cache dir to store temporary files (#1817) Accept embedded lyrics in more cases (#1818) Bump .so and plugin ABI versions retrospectively (#1819) Include Georgian translation (#1820) Fix build on systems using musl instead of glibc (#1823) Download: Audacious 4.6.1 | 48.2 MB (Open Source) Download: Portable Audacious 4.6.1 | 69.8 MB View: Audacious Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • I really wonder if this has to do with the built in VPN or "private DNS" of browsers that trip up legal requirements like cookie consent and Cloudflare (to avoid all the botnet attacks we get). And BTW some botnets still manage to get past Cloudflare, we are constantly having to tweak it to block malicious traffic that ultimately cause a DDoS.
  • Recent Achievements

    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
    • One Month Later
      agatameier earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      197
    3. 3
      PsYcHoKiLLa
      142
    4. 4
      ATLien_0
      89
    5. 5
      Steven P.
      80
  • Tell a friend

    Love Neowin? Tell a friend!