Skip to main content

What is Array in C#

Array is a collection of similar data types. In array we access the value using index.
Declaration of array
Int [ ] marks = new int [5];
Assigning value to the array
  1. Marks [0] = 90; Marks[1] = 80;
  2. Int [ ] marks = new int [ 5 ] { 2, 3,4,5,6 }
  3. Int [ ] marks = { 2, 3, 4,5, 6,7,8}
Retrieving value from Array
int Sum = 0;
For (int i=0; i<= marks. Length; i++)
{
Sum = Sum + marks [i];
}
Response. Write (sum);

Comments

Popular posts from this blog

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...

Difference between SQL Function and Stored Procedure

The main difference between functions and stored procedures  are given bellow: Function(User Defined) It returns only one value We can’t use transaction in function Only have input parameter We can’t called SP from function We can’t use exception handling using Try-Catch block in function We can use function in select/where/having statement Stored Procedure (Store Procedure) It returns zero, single or multiple values We can use transaction in SP Can have input/output parameter We can called function from SP We can use exception handling using Try-Catch block in SP We can’t use SP in select/where/having statement