41 Replies
in VSC im trying to make a symbol thing to start out wiuth i get this issue when clicking f5
i have both of these installed
you need to make a project
you can't just have a .cs file
SO i need to use community version?
no
Get started with C# and .NET in Visual Studio Code
Getting Started with C# and .NET Development in Visual Studio Code
the "Create a Hello World app" will teach you what you need to do to make it work
im switching to python to cs
this is much more complicated
Download VS Studio and create a project from a template
No need to pressure yourself into the dotnet command line right now
there is no command line in the linked directions
I figured out ,dot net project got hello world line working
\
why is this yellow?
C# supports nullability analysis
That means you'll get feedback on where Intellisense (i.e code analysis) thinks a null reference exception might happen
You can still compile and build, but the code analysis is telling you that you should handle the case when
ageInput
is null
heres another way i found
instead of string i used int
This will just output zero if no age was found
You should convert the string to an int after you've checked that the string is not null in the first place
i see
whats the point in
string? ageInput
The
?
next to string
simply converts it to a nullable stringah
You're basically matching your variable type with the return type of the ReadLine function, hence disabling the warning
Next time just use
var
instead of Convert functions you can use this as well:
if there's a possiblity of
null
you can also use int.TryParse(value,out int output)
, for more info refer to the official documentation
this is the modern approachalso In Cs how to i do print line for multiple lines i know in python we used \n\n
This question can be answered by a quick Google search
i did
ill try this
You don't wanna replace though
Console.WriteLine("hey");
$helloworldbetter follow the official guide for more
i founda goodf method i like
but anyways thanks for the help
ill go watch youtube videos
$helloworld may help