Home  >  Article  >  Backend Development  >  How to convert JavaScript array to C# array?

How to convert JavaScript array to C# array?

WBOY
WBOYforward
2023-09-01 12:57:061043browse

如何将 JavaScript 数组转换为 C# 数组?

Suppose our JavaScript array is -

<script>
   var myArr = new Array(5);
   myArr[0] = "Welcome";
   myArr[1] = "to";
   myArr[2] = "the";
   myArr[3] = "Web";
   myArr[4] = "World";
</script>

Now, convert the array to string using comma as delimiter -

document.getElementById(&#39;demo1&#39;).value = myArr.join(&#39;,&#39;);

Now, will Bring it to C# -

string[] str = demo.Split(",".ToCharArray());

Convert JavaScript array to C#.

The above is the detailed content of How to convert JavaScript array to C# array?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete