❔ inputing numbers into list
I want to imput numbers into a list until -1 typed... and then i would like to have it as variable so i can do what ever with it
127 Replies
hello
yeah im flustrated that i cant do this basic thing
but i get this error that nubers is not null here
Something not being
null
is unlikely to throw an error, something being null
mightThe one below is the actual error
And it's quite a clear one
can i return a list
Sure can
well is var numbers defined as a list
It seems to be, yes
Your method says it returns an
int[]
thoughoh ok that solves the error
btw how long have you been coding in c#
About 5 years or so?
you pref the language or you have other favourites
Yeah, C# would be my favourite. Although I quite enjoy PHP as well
do you study or work?
Mad man.
I work, as a teacher
oh nice at a uni?
One day hopefully, technical highschool for now
I've been coding in C# since 2003 and tbh, these days C# is so good its hard to use another language. I keep missing some feature or the other.
do you have some recommendation how can get into c# because its hard to write code for me...
Just making stuff tbh
coding is all about "learn by doing"
That's how I learned, picking random projects and googling them to completion or abandonment
yes but im asking for help every second
well i have homework that i have to code in c# thats what im doing here
we have to code in c# this semester
i really like python its so straight forward and the code is simple
but i dont have much experience with other languages
Python is okay for small scripts. Anything larger and it gets messy. Then again, last time I did anything with a larger python project was 5+ years ago.
But my day to day job involves working with 500K+ LOC projects
and thats where C# really shines, imho.
I do like Rust and F# thou.
next year i should choose subjects at uni like programming in .... i will prob look into CPP or c#,java,rust
will see
how can i set brake points in visual studio?
did you fix the bug in the code btw?
$debug
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Ah oof ouch owie my bones VS4Mac
ye i do use mac
VS for mac is not the same thing as VS, just so you are aware. Im sure it can debug, but its... quite a different experience over all
Since you're a student, do yourself a solid and get a free Rider license
$freerider
There are two ways to get Rider for free:
Being a student: https://www.jetbrains.com/community/education/#students
Using it for an OSS project: https://www.jetbrains.com/community/opensource/#support
^
Rider is excellent.
Infinitely better than VS4Mac
well is it that much better for writing code like im doing
Yes 🙂
I'd say so
and as a student its entirely free.
i also saw that sealion is there for writting cpp
now im using xcode for it
Yeah, CLion
yep, thats jetbrains C/C++ IDE
the good thing about jetbrains IDEs is that they are very similar
learn one, you more or less know the rest
but like for python i use visual studio code and not pycharm
There's also IntelliJ for Java and Kotlin
I use Rider for C#, IntelliJ for java, CLion for Rust
Etc
dont know it is overwhelming
and i dont need that much features for my python code like im doing BFS chill pycharm.
some people write much harder code in vim
without the features
Masochists and 70-year-old fossils, yes
vim has plenty of features btw
"Me grandaddy wrote with clay tablets and 's was good"
it has autocomplete, debugging, language server support, project management, file browser...
its just that its a fucking nightmare to setup properly 😄
ive even seen code coverage visualization in vim
which is just... why?
After the first gigabyte of config files Vim just turns into an ugly IDE, yeah
yep
tooling helps you write faster, and when it comes to C# specifically, autocomplete and intellisense is a godsend
and some stuff, like Riders built in ReSharper, can even help you write better
Yeah, I love how Rider points out "hey, did you know you could write it better?" lol
well maybe it will help
will see im downloading it probably in a minute
just fyi, unless you've changed it you still have a bug in
and if you want to get your hands dirty and do some projects, it wont hurt to have this list: $projects
Collections of application ideas that anyone can solve in any programming language to improve coding skills:
https://github.com/ZacharyPatten/dotnet-console-games
https://github.com/karan/Projects
https://github.com/florinpop17/app-ideas
still has the bug 🙂
ye should i copy yours?
nope, mine is just your old one
I want you to read it and think carefully about
num
🙂well it doesnt scream at me anymore
screaming is because of errors
this has a bug.
the IDE wont catch bugs
you'll have to do that on your own 🙂
is it something with the order
of me doing things
nope, its related to
num
and specifically how it never changes value 🙂oh uye
there ya go.
also when i want to print a list
do i have to do it with a for loop
probably cant to console.write(numbers)
thats what i did only writes stuff about the object
loop, or
string.Join
I prefer string joinwhat you mean about sting.join
like change the list of integers into a string and then join it and print it out
no there is a method called
string.join
that lets you turn a list into a stringString.Join Method (System)
Concatenates the elements of a specified array or the members of a collection, using the specified separator between each element or member.
@Pobiega
do i have to install any of these
nope
also string.join is super nice
that i dont have to do the forloop
i do hate this overwhelming IDE's its like when you open adobe programs or unity they offer ton but its a lot
Do you have some tips that i should use with rider
the new test UI looking better tho then standart
no tips and tricks other than to... use the IDE
use the reference finder, use go to def, use the refactoring helper
i thout that i could use .count()
for list
no,
Count
counts
you want Max
hmm
i just want to know the size of the list
so the for loop knows when to end
uhm
i mean if there is a function max that will print max val in a list
sure i will use that
you can skip the entire loop by using
Max
okey i will do that
but
i would like to solve that issue also
do i use count in a bad way
well its called
Count()
, not count
🙂
yep this line did the job
yup
typical things the IDE should help you with
im uploading a file to a thing that runs tests on it
¯\_(ツ)_/¯
if you have a
using System.Collections.Generic;
in the file, that should workwell it did not
hmm
can you show your complete code?
oh
my bad
it did
new error tho
.. do you have a
using System.Linq;
?this is my code
nope
ah, you probably are using globals
remove your global includes file
its messing it up for the external system
i do not know what you talking about
also how do i know what to write like using this and that
the IDE should help you, but its not, because in your project its already included via a global using
or implicit using
show me your .csproj file
and a screenshot of the solution explorer
ok, no globals.cs
so rightclick the project (green icon, recodex_uloha) and click "edit .csproj"
remove the <ImplicitUsings>
that entire line must go
ok i did
what does it do
it adds a bunch of standard
using
statements to each file at compile timeit worked
like the ones your program was using 🙂
ok so now i have to like manually write
what im using
yes
at the top
but your IDE will help you
if you just type "List<" Rider will suggest to include the generic namespace
same for .Max()
well it shows this when i delete the using linq
you cant just write it there thou :p
like, use the type in your code
in a valid location
yes
like so
thats nice
can i have more programs like Program.cs in one project
yes and no
yes, but not as you think
you can only have one
static Main()
methodso i cant use project as a folder
okey
you can have multiple projects thou
or do what I do
each of those folders is a "new project"
and in Program.cs all I do is "run" the project I really want
so its actually just one real project, but each folder is its own contained namespace with a
Program
class that has a static Run
methodoh nice
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.