

- 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
Finding the index of first element in the array in C#
To find the index of first element in the array, the code is as follows −
Example
using System; public class Demo { public static void Main() { string[] products = new string[] { "Andy", "Mark", "Gary", "Andre"}; Console.WriteLine("One or more name begin with 'A'? = {0}", Array.Exists(products, ele => ele.StartsWith("A"))); Console.WriteLine("Is the array having fixed size? = " + products.IsFixedSize); Console.WriteLine("Is the array read only? = " + products.IsReadOnly); Console.WriteLine("Is the array synchronized? = " + products.IsSynchronized); Console.WriteLine("Index of the 1st element = "+products.GetLowerBound(0)); } }
Output
This will produce the following output −
One or more name begin with 'A'? = True Is the array having fixed size? = True Is the array read only? = False Is the array synchronized? = False Index of the 1st element = 0
Example
Let us see another example −
using System; public class Demo { public static void Main() { string[] products = new string[] { }; Console.WriteLine("Is the array having fixed size? = " + products.IsFixedSize); Console.WriteLine("Is the array read only? = " + products.IsReadOnly); Console.WriteLine("Is the array synchronized? = " + products.IsSynchronized); Console.WriteLine("Index of the 1st element = "+products.GetLowerBound(0)); } }
Output
This will produce the following output −
Is the array having fixed size? = True Is the array read only? = False Is the array synchronized? = False Index of the 1st element = 0
- Related Questions & Answers
- Finding the index of last element in the array in C#
- Finding the index of the first element that violates the series (first non-consecutive number) in JavaScript
- Finding the first redundant element in an array - JavaScript
- Finding the first unique element in a sorted array in JavaScript
- Finding the index of the first repeating character in a string in JavaScript
- Finding first unique element in sorted array in JavaScript
- Finding the nth power of array element present at nth index using JavaScript
- Get the first element of array in JavaScript
- Finding the majority element of an array JavaScript
- Find the first repeating element in an array of integers C++
- Finding median index of array in JavaScript
- Finding the index position of an array inside an array JavaScript
- Python - Get the Index of first element greater than K
- Finding the first non-consecutive number in an array in JavaScript
- Remove the element at the specified index of the ArrayList in C#
Advertisements