---
title: "Starting Index of Arrays in C# and VB.Net"  
description: "Starting Index of Arrays in C# and VB.Net"  
author: "Anonymous User"  
published: 2013-04-08  
updated: 2013-04-08  
canonical: https://www.mindstick.com/forum/733/starting-index-of-arrays-in-c-sharp-and-vb-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Starting Index of Arrays in C# and VB.Net

Hi All!\
Have a look at the following code.,\
C#\
[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp)[] testString = new string[jobs.Count];Equivalent [VB.Net](https://www.mindstick.com/forum/426/sqlsever-2000-in-network-with-vb-dot-net-2008)\
[Dim](https://www.mindstick.com/interview/561/what-is-the-difference-between-the-dim-public-and-private-statements) testString() As String = New String(jobs.Count - 1) {}Why it is taking 'jobs.Count - 1' instead 'jobs.Count' in vb.net [while creating](https://www.mindstick.com/forum/105382/which-constraints-we-can-use-while-creating-a-database-in-sql) new [arrays](https://www.mindstick.com/articles/11955/arrays-and-its-limitations)?\
[Advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams) thanks!

## Replies

### Reply by AVADHESH PATEL

Hi Jacob!\
In C# the array has the number of elements you provide:\
string[] array = new string[2]; // will have two element [0] and [1]In VB.NET the array has the number of elements you provide, plus one (you specify the max index value):\
Dim array(2) As String // will have three elements (0), (1) and (2)\
I hope it helpful for you!\


---

Original Source: https://www.mindstick.com/forum/733/starting-index-of-arrays-in-c-sharp-and-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
