
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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#.
- Related Articles
- How to convert PHP array to JavaScript array?
- How to convert Multidimensional PHP array to JavaScript array?
- How to convert an array into a complex array JavaScript?
- How to convert array to object in JavaScript
- How to convert Array to Set in JavaScript?
- How to convert array of strings to array of numbers in JavaScript?
- How to convert Object’s array to an array using JavaScript?
- Convert integer array to string array in JavaScript?
- Convert array of object to array of array in JavaScript
- How to convert nested array pairs to objects in an array in JavaScript ?
- How to convert a node list to an array in JavaScript?
- How to convert an array into JavaScript string?
- How to convert a number into an array in JavaScript?
- How to convert a 2D array to a CSV string in JavaScript?
- Convert nested array to string - JavaScript

Advertisements