• 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

    • Just when I thought EA couldn't go lower. They surpassed my expectations
    • The GEEKOM A8 mini PC is 20% off (lower than Prime Day pricing) plus Huge Storewide Sale by Steven Parker GEEKOM is back with a deal on a variant of its A8 Mini PC powered by AMD's Ryzen 7 8945HS, which came out in 2024 with a TDP of just 45W, with a base clock of 3.8 GHz and a Turbo Boost of 4.9 GHz; although we never reviewed this variant, we did check out the Ryzen 9 version. As a reminder of what you get, below are the specifications for this Mini PC. GEEKOM A8 Dimensions 112.4 mm x 112.4 mm x 37 mm Weight 450g CPU Ryzen 7 8745HS (8 cores, 16 threads, 16MB L3 cache, 3.8 - 4.9 GHz, TDP: 45 W) cTDP: 35-54W (Default 45W) Graphics AMD Radeon™ 780M Graphics 12 RDNA 3 Graphics Cores 2700MHz 768 shading units / stream processors (12 CUs), 48 texture mapping units, and 32 ROPs NPU XDNA architecture (Up to 16 NPU TOPS) Memory 16GB Dual-channel Crucial DDR5-5600MT/s SODIMM (up to 64GB) Storage 1TB NVMe M.2 (PCIe Gen 4.0 x4) Operating System Windows 11 Pro Bluetooth Bluetooth v5.2 Wireless LAN Wi-Fi 6E Kensington Lock No SD Card reader Yes (left side) Adapter 120W, 6.32A, 19V Power Adapter Front I/O Ports 2 x USB 3.2 Gen 2 Type-A 1 x 3.5mm front stereo headset jack Rear I/O Ports 1 x USB 3.2 Gen 2 Type-A 1 x USB 4 Gen 3 Type-C with Power delivery up to 15W (5V 3A) 1 x USB 3.2 Gen 2 Type-C 1 x USB 2.0 Type-A 2 x HDMI 2.0b 1 x 2.5G RJ45 LAN 1 x DC-in Deal Price $519 (buying links below) GEEKOM has two configurations of the A8, with the only difference being the slightly less-powerful Ryzen 7 CPU with half the storage (1TB) and DDR5 memory (16GB). This knocks $350 off the price compared to the $999 Ryzen 9 configuration. In both instances, a Windows 11 Pro license is also pre-loaded. As I said previously, this appears to be an update on the A7 with the only difference being the newer CPU. The packaging has changed quite a bit from the A7. Instead of dark colors, now the box is completely white, and the foam cushion has been replaced by a cardboard mould that the A8 sits in, above a small envelope that contains a thank you card and booklet that has guidance on all of the controls, how to access the A8 to swap out the SSD or memory, and safety information in several European languages. Upon removing the cardboard mould, you can find another cardboard compartment that contains the power lead, HDMI cable, VESA plate, and a bag of screws. What’s In The Box 1 x A8 Mini PC 1 x Power Adapter 1 x HDMI Cable 1 x VESA plate and bag of screws 1 x Envelope with booklet and Thank you card Unlike the A7, the VESA mount option is back with the A8. In short, you have everything you need to get started. All products sold by GEEKOM receive a 3-year free Warranty from the date you receive the product. If needed, you can RMA or return locally relative to your region (the U.S. has a U.S. warehouse, mainland E.U. has a German warehouse). GEEKOM A8 at GEEKOM U.S. for $519 was $649 (20% off) GEEKOM A8 at GEEKOM U.K. for £503 was £629 (20% off) GEEKOM A8 at GEEKOM CA for $735.20 was $919 (20% off) Use coupon code NWGKA820 when checking out. This flash deal expires on July 2. Next up is the highest savings on the A7 Max series of Mini PC in the Spring Sale. The GEEKOM [2026 Edition] A7 MAX with AMD Ryzen 9 7940HS, 16GB DDR5, and 1TB SSD. Operating System: Windows 11 Pro CPU Model: Ryzen 9 7940HS CPU Speed: 5.2 GHz Cache Size: 24 MB Graphics Card Description: Integrated Graphics Coprocessor: AMD Radeon 780M Memory Storage Capacity: 16GB DDR5 SSD: 1 TB We reviewed this Mini PC back in January, and praised it for its modern internals like a dedicated NPU and DDR5 memory; as such, it is more than capable of keeping up with today's offerings of Mini PC on the market. GEEKOM A7 Max at GEEKOM U.S. for $587 (was $699) 16% off GEEKOM A7 Max at GEEKOM U.K. for £551 was £689 (20% off) Use coupon code NWGKA7MAX when checking out. This flash deal expires on July 2. Huge Summer Sale If the above deals don't tickle your fancy, from today, there are deep discounts on a range of other GEEKOM products. From June 15 to June 30, the GEEKOM Official Store will be running its Summer Sale, with discounts starting from 15% off across the entire lineup, up to 50%! This is their biggest promotion of the year so far, offering pricing that is even lower than select Prime Day deals. You can check out the discounts at the dedicated Summer Sale landing pages below. GEEKOM U.S. Summer Sale GEEKOM U.K. Summer Sale What's more, all products from GEEKOM receive a 3-year free Warranty from the date you receive the product. If needed, you can RMA or return locally relative to your region (the U.S. has a U.S. warehouse, mainland E.U. has a German warehouse, the U.K. has a U.K. warehouse, Australia has an AU warehouse). While the Summer Sale ends on June 30, deals on the A8 and A7 Max will remain active until July 2.
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • 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
  • Popular Contributors

    1. 1
      +primortal
      515
    2. 2
      +Edouard
      205
    3. 3
      PsYcHoKiLLa
      136
    4. 4
      ATLien_0
      88
    5. 5
      Steven P.
      86
  • Tell a friend

    Love Neowin? Tell a friend!