✅ string.Join returns System.Int32[]
In my constructor I am getting
T desiredValue
.
In this case T
is int[]
.
When debugging the below code:
I end up getting System.Int32[]
any idea why?14 Replies
Maybe has something to do with
desiredValue
being a string..?I have another member variable called
desiredValue
that is of type T
. It's weird convention I have to follow :/Ah, yeah,
desiredValue
is probably that System.Int32[]
string
And joining a single string... results in a single stringAngius#1586
REPL Result: Success
Result: string
Compile: 474.770ms | Execution: 29.346ms | React with ❌ to remove this embed.
renamed the string
desiredValue
to newValue
to avoid confusionHuh
Somewhere,
desiredValue
gets, somehow, turned into a stringLet me post the whole class.
No this is C#
Retax#0813
REPL Result: Success
Result: string
Compile: 528.068ms | Execution: 51.706ms | React with ❌ to remove this embed.
Should I just hard cast then?
newValue = string.Join(", ", (int[])this.desiredValue);
Retax#0813
REPL Result: Success
Result: string
Compile: 542.995ms | Execution: 54.950ms | React with ❌ to remove this embed.
But I am already checking if
typeof(T) == typeof(int[])
So in that case it should be fine?
Okay, thank you very much 🙂
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.