- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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