C
C#7mo ago
Deleted user

✅ how to start

help
No description
41 Replies
Deleted user
Deleted userOP7mo ago
in VSC im trying to make a symbol thing to start out wiuth i get this issue when clicking f5
Deleted user
Deleted userOP7mo ago
No description
Deleted user
Deleted userOP7mo ago
No description
Deleted user
Deleted userOP7mo ago
No description
Deleted user
Deleted userOP7mo ago
i have both of these installed
reflectronic
reflectronic7mo ago
you need to make a project you can't just have a .cs file
Deleted user
Deleted userOP7mo ago
SO i need to use community version?
reflectronic
reflectronic7mo ago
no
reflectronic
reflectronic7mo ago
the "Create a Hello World app" will teach you what you need to do to make it work
Deleted user
Deleted userOP7mo ago
im switching to python to cs this is much more complicated
CoRoys
CoRoys7mo ago
Download VS Studio and create a project from a template No need to pressure yourself into the dotnet command line right now
reflectronic
reflectronic7mo ago
there is no command line in the linked directions
Deleted user
Deleted userOP7mo ago
I figured out ,dot net project got hello world line working
Deleted user
Deleted userOP7mo ago
\
No description
Deleted user
Deleted userOP7mo ago
why is this yellow?
No description
Deleted user
Deleted userOP7mo ago
No description
CoRoys
CoRoys7mo ago
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
string? ageInput = Console.ReadLine();

if(ageInput is null)
{

// handle no age input

}
string? ageInput = Console.ReadLine();

if(ageInput is null)
{

// handle no age input

}
Deleted user
Deleted userOP7mo ago
No description
Deleted user
Deleted userOP7mo ago
heres another way i found instead of string i used int
CoRoys
CoRoys7mo ago
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
Deleted user
Deleted userOP7mo ago
i see
Deleted user
Deleted userOP7mo ago
whats the point in string? ageInput
No description
CoRoys
CoRoys7mo ago
The ? next to string simply converts it to a nullable string
Deleted user
Deleted userOP7mo ago
ah
CoRoys
CoRoys7mo ago
No description
CoRoys
CoRoys7mo ago
You're basically matching your variable type with the return type of the ReadLine function, hence disabling the warning Next time just use var
Salman
Salman7mo ago
instead of Convert functions you can use this as well:
c#
int age = int.Parse(Console.ReadLine());
c#
int age = int.Parse(Console.ReadLine());
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 approach
Deleted user
Deleted userOP7mo ago
also In Cs how to i do print line for multiple lines i know in python we used \n\n
CoRoys
CoRoys7mo ago
This question can be answered by a quick Google search
Deleted user
Deleted userOP7mo ago
i did
No description
Deleted user
Deleted userOP7mo ago
ill try this
CoRoys
CoRoys7mo ago
You don't wanna replace though
Salman
Salman7mo ago
Console.WriteLine("hey");
c#
string x = "some text \n new line will start from here \n and another line" ;
c#
string x = "some text \n new line will start from here \n and another line" ;
$helloworld
Salman
Salman7mo ago
better follow the official guide for more
Deleted user
Deleted userOP7mo ago
i founda goodf method i like
Deleted user
Deleted userOP7mo ago
No description
Deleted user
Deleted userOP7mo ago
but anyways thanks for the help ill go watch youtube videos
reflectronic
reflectronic7mo ago
$helloworld may help

Did you find this page helpful?