Home > Backend Development > C#.Net Tutorial > How to convert JavaScript array to C# array?

How to convert JavaScript array to C# array?

WBOY
Release: 2023-09-01 12:57:06
forward
1149 people have browsed it

如何将 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>
Copy after login

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

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

Now, will Bring it to C# -

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template