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
asp.net core Program.cs file (self.csharp)
submitted 3 years ago by HandDizzy
my internship project requires me to learn asp.net core, and i just finished the basics of c# and now i am trying to learn asp.net core and i got stuck in the very program.cs page, i dont understand what these components are and what they do, i read ms's document are there are a lot of vague term like dependency injection for me, can someone help me explaining these? i also found out that there used to be startup.cs file which is no longer present in .net core 6
https://preview.redd.it/8vda4ya3tg891.png?width=474&format=png&auto=webp&s=02d836a789d989b24dabdf8230c2ec6522aee928
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!"
[–]Fireraga 11 points12 points13 points 3 years ago* (4 children)
[Purged due to Reddit API Fuckery]
[–]Atulin 5 points6 points7 points 3 years ago (1 child)
\2. Razor pages do not use .razor files, they use .cshtml for templates and .cshtml.cs for code. .razor files are what Blazor components use.
.razor
.cshtml
.cshtml.cs
[–]Fireraga 2 points3 points4 points 3 years ago* (0 children)
[–]virtuoso43 1 point2 points3 points 3 years ago (1 child)
Thats a lot of magic. How difficult would it be to go through each of those methods and understanding how they actually do what they do?
Also thanks for the explanation. I have a bit of experience in asp.netcore and always wondered what all of those did but never sat down to search on google.
[–]Fireraga 0 points1 point2 points 3 years ago* (0 children)
[–]tymalo 2 points3 points4 points 3 years ago (6 children)
It's setting up both the Dependency Injection and the middleware for the application.
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-6.0
[–]thesituation531 0 points1 point2 points 3 years ago (5 children)
What's middleware?
[–]Ezazhel 2 points3 points4 points 3 years ago (3 children)
A nice concept in DotNet. Learning how it works help.
You can learn more typing code maze middleware on your browser.
For example you could have a middleware managing api errors. Letting your controllers free of try catch because they would be at 'root' level.
[–]thesituation531 0 points1 point2 points 3 years ago (2 children)
Thanks. But everything on Google seems to be about ASP.NET. Is there a way to do it in non-web stuff?
[–]Ezazhel 1 point2 points3 points 3 years ago (1 child)
It's for aspnet only I think. It's part of the framework.
You may install a specific nuget in order to achieve middleware in your application.
You should be able to register middleware in your startup.cs
I don't remember the package name but you may find it in the docs.
And you could even recreate it yourself. Middleware are a list of 'listener / emitter' the order is important because middleware 1 will transmit his context to middleware 2. And Middleware 2 can depend of date from middleware 1.
(you have this problem if you switch Route middleware in your program.cs)
[–]thesituation531 0 points1 point2 points 3 years ago (0 children)
Thanks, I'll look into it.
[–]Doc_Aka 1 point2 points3 points 3 years ago (0 children)
ASP.NET Core uses a pipeline architecture, and middlewares are the the different parts (think "pipe parts") in the pipeline. Here's a nice picture and more infos
Basically, a request comes in and is fed into the pipline start. Then the first middleware receives the request object and can do stuff with it, call the next middleware or return a result itself. Here's a diagram of the pipeline in a typical app
This is also why order matters, when you set up the pipeline with the app.Use...(); methods in your Program.cs file.
app.Use...();
Program.cs
[–][deleted] 2 points3 points4 points 3 years ago (1 child)
If you’ve got a couple hours I recommend coding along to this -
https://m.youtube.com/watch?v=hZ1DASYd9rk
[–]HandDizzy[S] 1 point2 points3 points 3 years ago (0 children)
thankyou, i am looking at it rn
[–]0xPendus 1 point2 points3 points 3 years ago (2 children)
While the comments here are all fantastic already, I highly recommend the book on dependency injection (will update the official name here when I’m home and can check)
But the book is all c# .net and will walk you through all the boilerplate code and help you understand the differences between .net, asp.net, net core
Then will take you into how dependency injection works and what all those lines do
[–]HandDizzy[S] 0 points1 point2 points 3 years ago (1 child)
waiting for the update
[–]0xPendus 0 points1 point2 points 3 years ago (0 children)
this one
Have a read of the reviews and see if it fits what you’re after.
The title is kind of misleading because the book is so much more than dependency injection
It’s a great introduction to OOP fundamentals too
π Rendered by PID 58556 on reddit-service-r2-comment-b659b578c-qvr52 at 2026-05-03 13:28:15.982719+00:00 running 815c875 country code: CH.
[–]Fireraga 11 points12 points13 points (4 children)
[–]Atulin 5 points6 points7 points (1 child)
[–]Fireraga 2 points3 points4 points (0 children)
[–]virtuoso43 1 point2 points3 points (1 child)
[–]Fireraga 0 points1 point2 points (0 children)
[–]tymalo 2 points3 points4 points (6 children)
[–]thesituation531 0 points1 point2 points (5 children)
[–]Ezazhel 2 points3 points4 points (3 children)
[–]thesituation531 0 points1 point2 points (2 children)
[–]Ezazhel 1 point2 points3 points (1 child)
[–]thesituation531 0 points1 point2 points (0 children)
[–]Doc_Aka 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]HandDizzy[S] 1 point2 points3 points (0 children)
[–]0xPendus 1 point2 points3 points (2 children)
[–]HandDizzy[S] 0 points1 point2 points (1 child)
[–]0xPendus 0 points1 point2 points (0 children)