• 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

    • My father still uses a programme written in dbase3. Still manages to work with a little help from dosbox. 
    • Microsoft hides these secret Windows 11 performance boost settings available on every PC by Sayan Sen Windows enthusiasts often look for ways to extract as much performance out of their systems as possible, and it's often the case that they try and do so while trying to minimize the heat and power consumption. This is especially relevant in the case of mobile Windows PCs since laptops and notebooks tend to get hot and management of that heat and power is harder in such a form factor. As such users often turn to techniques like under-volting which can be used to squeeze out the maximum capabilities of a chip while also maintaining lowered power levels. There are official apps from AMD and Intel with the likes of Ryzen Master and XTU (Extreme Tuning Utility). While these are quite handy, most enthusiasts probably prefer to dig into the BIOS and play around with settings there like Curve Optimizer on Ryzen, which lets users set various frequency-voltage scaling values. These are essentially called P-States. If you are not familiar with them, Processor Power Management is done through Advanced Configuration and Power Interface (ACPI) P-states and C-states. While P-states or performance pwoer states handle CPU voltage-frequency scaling, C-states deal with CPU sleep states so that some of the CPU functions, which are not necessary at that moment, can be disabled. The P-states and C-states work together to make the processor run more efficiently. It helps the OS and apps determine which cores can be parked and which should be boosted. Of course not every user is an enthusiast or knows the technicalities and integrities of how things like overclocking or undervolting work. Thankfully for them Windows itself offers something pretty cool, though it is hidden by default on all systems. By default, Windows only has two P-States, "Minimum Processor State" and "Maximum Processor State." However, this can be changed with a Registry trick to expand the options under a secret "Processor performance boost mode" dropdown. This essentially enables the HWP or hardware P-States available on a device, and these are not controlled just by the OS itself as the underlying hardware gets involved too. In total there are five Processor Performance Boost Mode profiles that control how Windows requests and allows CPU turbo/boost behavior under the different power policies. They are: Disabled: In this mode, processor boosting is effectively turned off. The CPU will avoid entering turbo or boost frequencies and instead operate closer to its base frequency ceiling. This can significantly reduce power consumption and heat output, but at the cost of reduced burst performance and responsiveness in short workloads. Enabled: This is the standard behavior where boost functionality is allowed under normal conditions. The processor can opportunistically increase frequency when workload demands it, balancing performance gains with power and thermal constraints as managed by the system. Aggressive: Aggressive mode favors performance more heavily, allowing the CPU to enter higher boost states more readily and sustain them longer. This should in theory improve responsiveness under bursty or heavy workloads but increases power draw and thermal output compared to the default enabled behavior. Efficient Enabled: This mode still allows boosting, but with a stronger bias toward energy efficiency. The system attempts to use boost more selectively, avoiding unnecessary frequency spikes when the performance gain is marginal. Efficient Aggressive: This is a hybrid approach where boost is still performance-responsive, but the system continuously weighs efficiency more heavily than in Aggressive mode. It aims to deliver noticeable performance improvements while reducing wasted power in less demanding scenarios. Here's how to enable the Processor performance boost mode: Open Registry Editor: Press Win+R, type regedit, and click OK. Go to: HKLM\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\54533251-82be-4824-96c1-47b60b740d00\be337238-0d82-4146-a960-4f3749d470c7 (where HKLM stands for HKEY_LOCAL_MACHINE_) Modify the value of Attributes from 1 to 2 (you can find modify option by right-clicking) After that, exit Registry, you should now be able to see the new "Processor performance boost mode" dropdown menu: As you can see there are now five new P-States or CPPC states or power profile available that help define the boost mode processor setting on your PC. Wrapping it up here's a quick run-down of the settings as defined by Microsoft itself. Setting Description Disabled The corresponding P-state-based behaviour is disabled. Collaborative Processor Performance Control (CPPC) behaviour is disabled. Enabled The corresponding P-state-based behaviour is enabled. CPPC behaviour is Efficient Enabled. Aggressive The corresponding P-state-based behaviour is enabled. CPPC behaviour is Aggressive. Efficient Enabled The corresponding P-state-based behaviour is Efficient. CPPC behaviour is Efficient Enabled. Efficient Aggressive The corresponding P-state-based behaviour is Efficient. CPPC behaviour is Aggressive. Aggressive At Guaranteed Windows calculates the desired extra performance above the guaranteed performance level, and asks the processor to deliver that specific performance level. Efficient Aggressive At Guaranteed Windows always asks the processor to deliver the highest possible performance above the guaranteed performance level. In the next part we shall be comparing these settings to explore how much of a benefit or regression they can provide in terms of performance and power efficiency. If you decide to change the values on your system and are experiencing problems like crashes or an overheating PC, make sure to revert the steps back to the original state.
    • I think he means you haven't reviewed previous UFC games. Of course it doesn't matter... Every time you just report on something that involves the President even if just simply what happened you guys usually get accused of being anti-Trump. We live in fun times.
  • Recent Achievements

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

    1. 1
      +primortal
      518
    2. 2
      +Edouard
      198
    3. 3
      PsYcHoKiLLa
      147
    4. 4
      ATLien_0
      93
    5. 5
      Steven P.
      78
  • Tell a friend

    Love Neowin? Tell a friend!