Ask a Question

Working with array in dotNET

minhterry
Contributor

Working with array in dotNET

Hello,



I have problem with object XXX that i get from dotNET CLR BRIDGE.



It has a property that accep System.String[]

Example: xxx["ChildId"]

So how can i set the value to that property.



I tried: xxx["ChildId"] = {"Alice","Dominate"} , but not success

Please help me.



--

Regards,

MinhT







3 REPLIES 3
HKosova
SmartBear Alumni (Retired)

Hi MinhT,



Try one of these:



Create a .NET array by splitting a string by whitespace:



Create an array and set values dynamically:

var arr = dotNET.System.Array.CreateInstance(dotNET.System.String.Empty.GetType(), 2 /* length */);

arr.SetValue("Alice", 0);

arr.SetValue("Dominate", 1);

Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
minhterry
Contributor

Hello Helen Kosova,



The first is error. But the second works. You save my day.



--

Thanks a lot,

MinhT
minhterry
Contributor

I don't know, just do both and only the second works.
cancel
Showing results for 
Search instead for 
Did you mean: