✅ `... void SomeFunction(string parameters...)` function in CSharp
In java you can define functions that take "infinite" parameters (i forgot the name) with the
type name...
syntax and then when calling the function you could parse arguments like this "A", "B", "C"
without a limit to how many you can give it
and the argument you get in the function itself is a array
is there a way to do the same thing in c#?10 Replies
params string[] args
im basically looking for this in c#
have seen that on stackoverflow, but it gives me this error (i know how to fix it, but i dont want to have to declare an array to parse to the constructor)
Constructor 'GetName' has 1 parameter(s) but is invoked with 2 argument(s)
what constructor
what does your code look like
Cyberrex#8052
REPL Result: Success
Console Output
Compile: 584.931ms | Execution: 91.082ms | React with ❌ to remove this embed.
this is (the snippet of) my code my code:
this should compile
and it does
leaving things out and not giving the code that actually has the error isn't too helpful
oh nvm, im stupid i had another one that just took a string array without the params keyword
i removed the other constructor and it works now
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.