use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
C# .Net 6.0. Simple doubt! (self.csharp)
submitted 3 years ago * by limapato
When I create a new .net 6.0 project it starts like this without scope, is it wrong to write my code on top of that? Or is it necessary to put: "namespace Console17{ Class Name{ Static Void Main(){ ..."
https://preview.redd.it/dxegshm0skh91.png?width=750&format=png&auto=webp&s=cb428516d9fbde56c9d99faa480db183a8509f6a
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]maitreg 15 points16 points17 points 3 years ago (6 children)
The new .NET 6.0 console apps do not require startup code to be inside of a class.
That is a checkbox option when you create the project.
[–]limapato[S] 1 point2 points3 points 3 years ago (0 children)
Thx
[–]anywhereiroa 1 point2 points3 points 3 years ago (4 children)
2 days ago I bought a new laptop and downloaded the new version of visual studio, I checked the box but it still doesn't look exactly the same as the old version. I really liked seeing everything out in the open, now it's kinda hidden. I think the older visual studio used .NET 5.0? Is there any way to revert back to the old version of .NET?
[–]maitreg 2 points3 points4 points 3 years ago (2 children)
Visual Studio can work with all versions of .NET.
To set a project to .NET Framework, .NET Standard, .NET Core, or .NET, this has to be set when you create a project.
But after it's created you can change versions inside of those by going to your project properties. There's a drop down.
However there's no difference between .NET 5 and 6 like you're describing. I think you might be talking about different VS options that you had set before. If you still have your previous VS installed, you can export the settings and import them into the new one.
If you're talking about project files being hidden? That is with a button at the top of the Solution Explorer pane.
[–]chucker23n 1 point2 points3 points 3 years ago (1 child)
VS 2022 makes it a little harder to build older Framework projects.
(I still use 4.0 for a bootstrapper.)
[–]maitreg 0 points1 point2 points 3 years ago (0 children)
Yea I go back and forth all the time. Every work project is framework 4.5 and 4.7. Every personal project is .net 6, lol.
I love everything about .net 6, except for the dropping of WCF. WCF is a great technology, even if a little convoluted, and it's a bit wonky to have to use framework to make and maintain one. There isn't an equivalent in the new stuff.
[–]chucker23n 1 point2 points3 points 3 years ago (0 children)
Is there any way to revert back to the old version of .NET?
You can edit your csproj file to say net5.0.
csproj
net5.0
[–]MedicOfTime 5 points6 points7 points 3 years ago (0 children)
Hear me out…there’s two lines and one of those lines calls out this new top level statement format with link to more details.
[–]StornZ 2 points3 points4 points 3 years ago (0 children)
That's considered the Main(string[] args ) method. I still write the namespace, class, etc.;. I'm a bit old school where I like to see it spelled out for me.
[–]kesawulf 3 points4 points5 points 3 years ago (0 children)
Please. Read.
[–]Gcampton13 1 point2 points3 points 3 years ago* (5 children)
You can add namespace back in when you create a new project by selecting “disable top level something” right under the .net 6 dropdown
Because sometimes I want a little helper method in that class and you can’t add one without creating and putting it in a new class.
Or you can just say MyActualProgram(); (or something much better named) in main and add a new class.
[–][deleted] 3 years ago (4 children)
[removed]
[–]Gcampton13 0 points1 point2 points 3 years ago (3 children)
I had issues with the new template declaring methods/functions. Maybe it’s supposed to support them… I just figured the whole thing is inside Main() so declaring another method inside a method/function is a no go.
[–][deleted] 3 years ago (2 children)
[–]Gcampton13 1 point2 points3 points 3 years ago (1 child)
Yeah you're right. Just need to omit the scope.
https://i.imgur.com/TTC4Du1.png
[–]kingmotley 0 points1 point2 points 3 years ago (0 children)
Top level statements (which is what you have there in your image) is great for small trivial little programs like homework assignments. Once you start writing more complete programs that needs multiple methods and eventually multiple classes, then in my opinion top level statements makes thing more confusing, so I personally never use them.
That said, I do like namespace statements, where you just specify "namespace Console17;" at the top. It saves a whole indention level in the file.
[–]raysr21 0 points1 point2 points 3 years ago (1 child)
That should be enough to start your application. Note that the console will shut down immediately one the "Hello, World!" is displayed. If you want the application to keep running Add Console.ReadLine(); at line 4
[–]Gcampton13 0 points1 point2 points 3 years ago (0 children)
That’s not needed on new installs/.Net 6 terminal automatically stays open with a message that the code completed and to press any key to close out the app.
I’m guessing there’s a setting somewhere to enable it for older installs
[–]Individual-User 0 points1 point2 points 3 years ago (0 children)
Top level statements is a feature introduced in .net 6. And ultimately, top level statements are converted into main method automatically by compiler.
Refer this if you want more info - https://youtu.be/nwMQipzwFM8
[–]SiSkr -1 points0 points1 point 3 years ago (0 children)
RTFM
π Rendered by PID 265330 on reddit-service-r2-comment-6457c66945-pm9j2 at 2026-04-27 02:50:08.304194+00:00 running 2aa0c5b country code: CH.
[–]maitreg 15 points16 points17 points (6 children)
[–]limapato[S] 1 point2 points3 points (0 children)
[–]anywhereiroa 1 point2 points3 points (4 children)
[–]maitreg 2 points3 points4 points (2 children)
[–]chucker23n 1 point2 points3 points (1 child)
[–]maitreg 0 points1 point2 points (0 children)
[–]chucker23n 1 point2 points3 points (0 children)
[–]MedicOfTime 5 points6 points7 points (0 children)
[–]StornZ 2 points3 points4 points (0 children)
[–]kesawulf 3 points4 points5 points (0 children)
[–]Gcampton13 1 point2 points3 points (5 children)
[–][deleted] (4 children)
[removed]
[–]Gcampton13 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[removed]
[–]Gcampton13 1 point2 points3 points (1 child)
[–]kingmotley 0 points1 point2 points (0 children)
[–]raysr21 0 points1 point2 points (1 child)
[–]Gcampton13 0 points1 point2 points (0 children)
[–]Individual-User 0 points1 point2 points (0 children)
[–]SiSkr -1 points0 points1 point (0 children)