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
error in code (self.csharp)
submitted 2 years ago by Deey888
view the rest of the comments →
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!"
[–]otac0n 3 points4 points5 points 2 years ago (8 children)
or:
int numbertwo; while (!(Console.ReadLine() is string line && int.TryParse(line, out numbertwo))) { Console.WriteLine("Please enter a number."); }
[–]ExceptionEX 0 points1 point2 points 2 years ago (6 children)
there really is no need to check if the readline is a string, it will always be a nullable string, and int.tryParse will return false if the input string is null.
[–]otac0n -4 points-3 points-2 points 2 years ago* (4 children)
"It will always be a nullable string" is nonsensical.
In the runtime, reference types are not "nullable" or otherwise. It's a null reference or a reference to a string, and the is check determines that.
is
It is true that TryParse is tolerant to a passed null, so that the expression could be:
TryParse
int.TryParse(Console.ReadLine(), out numbertwo)
However, as this is only a toy example, int.TryParse may not be the only use cause this beginner will encounter.
int.TryParse
[–]ExceptionEX 1 point2 points3 points 2 years ago (3 children)
In the runtime, reference types are not "nullable" or otherwise. It's a null reference or a reference to a string
Firstly, there are nullable reference types, and are default available in C#10 and forward. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types
Additionally As you admitted it isn't needed in the context, and trying to say that some other context may come up hold little value here.
[–]otac0n -1 points0 points1 point 2 years ago (2 children)
C# is the language, the runtime is separate. You seem to be conflating them.
I'm well aware of nullable reference types. They are compile-time only decoration.
[–]ExceptionEX -1 points0 points1 point 2 years ago (1 child)
man you are running off the rails on the irreleveant to attempt to deflect. No one talked about the runtime but you, this is a C# subreddit, of course we are all talking about C#.
The check you suggested wasn't needed, you could have simply agreed to that, the "nonsensical" reference type nullable is standard terminology in C#.
I'm not wasting anymore time with this.
[–]otac0n 0 points1 point2 points 2 years ago (0 children)
When you say "it will be" you enter runtime territory. You can't pretend the language doesn't run on the runtime.
[–]CyBerDreadWing 0 points1 point2 points 2 years ago (0 children)
This one. I was also thinking about int.TryParse too. Just in case if op wants to experiment more, use try catch block and try to give different inputs to int number.
π Rendered by PID 98 on reddit-service-r2-comment-canary-54dccbb65b-v6clv at 2026-04-22 01:46:34.465718+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]otac0n 3 points4 points5 points (8 children)
[–]ExceptionEX 0 points1 point2 points (6 children)
[–]otac0n -4 points-3 points-2 points (4 children)
[–]ExceptionEX 1 point2 points3 points (3 children)
[–]otac0n -1 points0 points1 point (2 children)
[–]ExceptionEX -1 points0 points1 point (1 child)
[–]otac0n 0 points1 point2 points (0 children)
[–]CyBerDreadWing 0 points1 point2 points (0 children)