• 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

    • Ocenaudio 3.19.3 by Razvan Serea  Ocenaudio is a full featured, fast and easy to use audio and music editor. It is the ideal software for people who need to edit and analyze audio files without complications. Ocenaudio also has powerful features that will please more advanced users. To assist ocenaudio development, a powerful toolset of audio editing, analysis and manipulation called Ocen Framework was created. ocenaudio is also based on Qt framework, a well known library for cross-platform development. Cross-platform support ocenaudio is available for all major operating systems: Microsoft Windows, Mac OS X and Linux. Native applications are generated for each platform from a common source, in order to achieve excelent performance and seamless integration with the operating system. All versions of ocenaudio have a uniform set of features and the same graphical interface, so the skills you learn in one platform can be used in the others. VST plugins support Ocenaudio supports VST (Virtual Studio Technology) plugins, giving its users access to numerous effects. Like the native effects, VST effects can use real-time preview to aide configuration. Real-time preview of effects Applying effects such as EQ, gain and filtering is an important part of audio editing. However, it is very tricky to get the desired result by adjusting the controls configuration alone: you must listen the processed audio. To ease the configuration of audio effects, ocenaudio has a real time preview feature: you hear the processed signal while adjusting the controls. The effect configuration window also includes a miniature view of the selected audio signal. You can navigate on this miniature view in the same way as you do on the main interface, selecting parts that interest you and listening to the effect result in real time. Multiselection for delicate editions To speed up complex audio files editing, ocenaudio includes multi-selection. With this amazing tool, you can simultaneously select different portions of an audio file and listen, edit or even apply an effect to them. For example, if you want to normalize only the excerpts of an interview where the interviewee is talking, just select them and apply the effect. Eficient edition of large files With ocenaudio, there is no limit to the length or the quantity of the audio files you can edit. Using an advanced memory management system, the application keeps your files open without wasting any of your computer's memory. Even in files several hours long, common editing operations such as copy, cut or paste happen almost instantly. Fully featured spectrogram Besides offering an incredible waveform view of your audio files, ocenaudio has a powerful and complete spectrogram view. In this view, you can analyze the spectral content of your audio signal with maximum clarity. Advanced users will be surprised to find that the spectrogram settings are applied in real time. The display is updated immediately when altering features such as the number of frequency bands, window type and size and dynamic range of the display. Ocenaudio 3.19.3 changelog: Fixes issues with MP4 files with more than 8 channels Fixes incorrect VBR detection for some CBR MP3 files Other bug fixes and improvements Download: Ocenaudio 64-bit | Portable | ~40.0 MB (Freeware) Download: Ocenaudio for Linux and Mac OS View: Ocenaudio Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • DiskGenius 6.2.0.1829 - All Versions: Free, Lite & Portable by Razvan Serea DiskGenius is a full-featured partition manager, which is designed to optimize disk usage for Windows users. It will efficiently help you recover lost data, resize/split partition, backup files, edit hex data, check bad sectors, manage virtual disks, erase data, etc.. Create a system image backup for current Windows with simple clicks to keep the operating system under protection. DiskGenius key features: Partition Management - It can create format, resize, extend, backup, split, hide and clone partition, both MBR and GPT are supported. Disk and partition conversion - Convert dynamic disk to basic, convert virtual disk format and convert MBR to GPT, convert primary partition to logical. File recovery - It can recover files deleted or emptied form recycle bin, recover files from damaged partition or disk and recover files by file type and supports file preview and file filter. Partition recovery - It is the best partition recovery program in that it can recover files from damaged, corrupted and RAW partitions, search for lost partition and recover files from it, besides, it can fix partition table. RAID recovery - It can reconstruct Virtual RAID and recover files from it, and all RAID types are supported. Sector Editor - A Hex editor is embedded to help users edit raw hex data and recover data manually. Backup and Restore - It can backup and restore partition including system partition, hard disk and partition table. Bad Tracks - It can check and repair bad sectors for all storage devices; check hard disk S.M.A.R.T. information. Delete files permanently - It can delete files permanently so that they can't be recovered by any data recovery software. Virtual Disk - It supports virtual disks, including VMware, Virtual PC and Virtual Box. Create WinPE bootable disk and you can manage disk partition when system crashes or there is no operating system on your computer. Support FAT12/FAT16/FAt32/exFAT/NTFS/EXT2/EXT3/EXT4 file system format. DiskGenius 6.2.0.1829 changelog: Add the "Disk Speed Test" feature. Add the "Windows Boot Repair and Conversion" feature. Add the BMB21-2019 erase standard to the "Erase Sectors" feature. Add support for restoring an individual partition from a PMFX disk image file. Enhanced The "Verify Or Repair Bad Sectors/Blocks" feature displays disk read speed in the detection window during scanning. The "Quick Partition" dialog box allows users to quickly select the number of partitions by pressing the numeric keys 1, 2, 7, 8, or 9. The "Set Volume Name" dialog box supports selecting preset volume labels provided by the software. The "Copy Sectors" feature supports resuming copy tasks after modifying the number of skipped bad sectors. Add the "TRIM Optimization" option to the format dialog box. The "Clone Partition" and "Clone Disk" features perform TRIM optimization on target partitions or disks before cloning. Add support for Not Equal To search conditions (prefixed with "!") when searching hexadecimal data in the sector editor. Optimize the display of capacity values in the program interface to show two decimal places. Add a minimize button to dialogs that may require long processing time. Enhance support for the ReFS file system. Enhance support for newer HIF and MP4 formats when recovering files by type. Enhance support for the EXT4 file system. Enhance compatibility of the "File Recovery" feature with special data structures. Fixed Fixed the issue that the selected file system type automatically reverted to NTFS after changing it to exFAT or EXT4 in the "Quick Partition" dialog box. Fixed inaccurate Unicode string search results in the "Sector Editor" feature. Fixed the issue that exceptions might occur when adding multiple disks in the "Erase Sectors" feature. Fixed the issue that insufficient target disk space was incorrectly reported in some cases when cloning, backing up, or restoring disks. Fixed the issue that folder modification timestamps were not preserved when copying files from ReFS partitions. Fixed the issue that Excel-format reports generated by features such as file copying or bad sector checking could not be opened when the report contained more than one million rows. Fixed the issue that folders were not displayed in the exclude-folder dialog box when backing up partitions to image files. Fixed the issue that the "Erase Sectors" feature could not be executed in some cases. Download: DiskGenius 6.2.0.1829 | 63.9 MB (Freeware, paid upgrade available) Download: DiskGenius Portable 64-bit | 40.0 MB Download: DiskGenius Portable 32-bit | 36.0 MB Download: DiskGenius Lite 64-bit | 13.4 MB Download: DiskGenius Lite 32-bit | 11.6 MB View: DiskGenius Home Page | DiskGenius Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Really? Use a better search engine https://www.google.com/search?...ourceid=chrome&ie=UTF-8
  • Recent Achievements

    • Week One Done
      agatameier earned a badge
      Week One Done
    • One Month Later
      agatameier earned a badge
      One Month Later
    • Week One Done
      ssd21345 earned a badge
      Week One Done
    • Contributor
      MarkHughes4096 went up a rank
      Contributor
    • Dedicated
      jordanspringer earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      513
    2. 2
      +Edouard
      182
    3. 3
      PsYcHoKiLLa
      143
    4. 4
      ATLien_0
      95
    5. 5
      Steven P.
      74
  • Tell a friend

    Love Neowin? Tell a friend!