
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are static or fixed length arrays in C#?
A static array is a data structure with a fixed size. Let us see an example of a static array in C#.
Here is a static string array. The data remains the same here i.e. fixed −
static string[] _fruits = new string[] { "apple", "mango" };
Now let us see the complete example to create and access static arrays in C# −
Example
using System; class Demo { static void Main() { foreach (string fruits in Program.Fruits) { Console.WriteLine(fruits); } } } public static class Program { static string[] _fruits = new string[] { "apple", "mango" }; public static string[] Fruits { get { return _fruits; } } }
- Related Questions & Answers
- Fixed (or static) Partitioning in Operating System in C++
- What are variable length (Dynamic) Arrays in Java?
- What are static member functions in C#?
- What is length in Java Arrays?
- What are dynamic arrays in C#?
- What are jagged arrays in C#?
- What are mixed arrays in C#?
- Variable Length Arrays in C and C++
- What are Long term financial requirements or fixed capital requirement in finance?
- What are parameter/param arrays in C#?
- What are two-dimensional arrays in C#?
- Does C++ support Variable Length Arrays
- What are static members of a C# Class?
- What are the local static variables in C language?
- What are the restrictions imposed on a static method or a static block of code in java?
Advertisements