Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to convert a JavaScript array to C# array?
Let us say 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 into a string using comma as a separator −
document.getElementById('demo1').value = myArr.join(',');
Now, take this to C# −
string[] str = demo.Split(",".ToCharArray());
The above converts the JavaScript array to C#.
Advertisements
