- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 do I determine the size of my array in C#
Firstly, set an array −
int[] arr = {6, 3, 8, 4};
Now, use the Length property to get the size of the array −
arr.Length
Let us see the complete code −
Example
using System; namespace Demo { public class Demo { public static void Main(string[] args) { int[] arr = {6, 3, 8, 4}; Console.WriteLine("Array..."); foreach (int i in arr) { Console.Write(i + " "); } Console.WriteLine("
Size of Array: "+arr.Length); } } }
Output
Array... 6 3 8 4 Size of Array: 4
- Related Articles
- How do I find the length of an array in C/C++?
- How do I find the location of my Python site-packages directory?
- How do I set the size of a list in Java?
- How do I find the size of a Java list?
- How do I change the font size of ticks of matplotlib.pyplot.colorbar.ColorbarBase?
- How do I make my string comparison case insensitive?
- How do I redirect my web page with JavaScript?
- PHP: How do I display the contents of a textfile on my page?
- How do I let my Matplotlib plot go beyond the axes?
- How do I change the font size of the scale in Matplotlib plots?
- How do I check what version of Python is running my script?
- How do I delete SharedPreferences data for my Android App?
- How do I find out the size of a canvas item in Tkinter?
- How do I change button size in Python Tkinter?
- How do I change current theme at runtime in my android app?

Advertisements