Click here to Skip to main content
15,446,510 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Preparing for the future... Pin
GuyThiebaut11-Dec-21 7:15
professionalGuyThiebaut11-Dec-21 7:15 
GeneralWhat sort of progression is this? Pin
honey the codewitch4-Dec-21 12:44
mvahoney the codewitch4-Dec-21 12:44 
GeneralRe: What sort of progression is this? Pin
Daniel Pfeffer5-Dec-21 1:19
professionalDaniel Pfeffer5-Dec-21 1:19 
GeneralRe: What sort of progression is this? Pin
honey the codewitch5-Dec-21 1:26
mvahoney the codewitch5-Dec-21 1:26 
GeneralRe: What sort of progression is this? Pin
CodeWraith7-Dec-21 5:27
MemberCodeWraith7-Dec-21 5:27 
RantRe: What sort of progression is this? Pin
Gary Wheeler31-Dec-21 4:16
MemberGary Wheeler31-Dec-21 4:16 
GeneralRe: What sort of progression is this? Pin
jschell23-Jan-22 8:57
Memberjschell23-Jan-22 8:57 
General.Net Core 6 jumps the shark PinPopular
raddevus28-Nov-21 6:28
mvaraddevus28-Nov-21 6:28 
File this one under Weird.

I just built a new project in .NET Core 6 using the command:
c:\> dotnet new console -o SuperConsole


This produced a basic console app that outputs "Hello, World!"
Then I took a look at Program.cs and noticed that the entirety of the code is:
C#
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

No Main Function!?!
Yep, that's right. There is no main function!!
Here's the link that explains it.
C# template changes in .NET 6 - .NET | Microsoft Docs[^]

Here's a bit of explanation from the site:

Explanation at link:
You can look at the code for the new application and imagine that it contains the statements inside the Main method generated by earlier templates. You can add more statements to the program, just like you can add more statements to your Main method in the traditional style. You can even add functions. They're created as local functions nested inside the generated Main method.


I'ma no on that. Functions nested in Main? Hmmm | :|

And it tells you that you can still add in the Main method the old way yourself and use it that way.

Is C# trying to be JavaScript?
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak28-Nov-21 6:41
mveDave Kreskowiak28-Nov-21 6:41 
GeneralRe: .Net Core 6 jumps the shark Pin
raddevus28-Nov-21 6:44
mvaraddevus28-Nov-21 6:44 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak28-Nov-21 6:47
mveDave Kreskowiak28-Nov-21 6:47 
GeneralRe: .Net Core 6 jumps the shark Pin
Jon McKee28-Nov-21 9:35
professionalJon McKee28-Nov-21 9:35 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak28-Nov-21 9:37
mveDave Kreskowiak28-Nov-21 9:37 
GeneralRe: .Net Core 6 jumps the shark Pin
MSBassSinger29-Nov-21 4:28
professionalMSBassSinger29-Nov-21 4:28 
GeneralRe: .Net Core 6 jumps the shark Pin
Phil.Benson8-Dec-21 1:28
professionalPhil.Benson8-Dec-21 1:28 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak8-Dec-21 1:31
mveDave Kreskowiak8-Dec-21 1:31 
GeneralRe: .Net Core 6 jumps the shark Pin
Phil.Benson8-Dec-21 2:01
professionalPhil.Benson8-Dec-21 2:01 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak8-Dec-21 2:04
mveDave Kreskowiak8-Dec-21 2:04 
GeneralRe: .Net Core 6 jumps the shark Pin
Phil.Benson8-Dec-21 2:06
professionalPhil.Benson8-Dec-21 2:06 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak8-Dec-21 2:10
mveDave Kreskowiak8-Dec-21 2:10 
GeneralRe: .Net Core 6 jumps the shark Pin
Phil.Benson8-Dec-21 2:20
professionalPhil.Benson8-Dec-21 2:20 
GeneralRe: .Net Core 6 jumps the shark Pin
jschell23-Jan-22 9:01
Memberjschell23-Jan-22 9:01 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak23-Jan-22 9:32
mveDave Kreskowiak23-Jan-22 9:32 
GeneralRe: .Net Core 6 jumps the shark Pin
jschell30-Jan-22 6:04
Memberjschell30-Jan-22 6:04 
GeneralRe: .Net Core 6 jumps the shark Pin
Dave Kreskowiak30-Jan-22 6:07
mveDave Kreskowiak30-Jan-22 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.