---
title: "Create new reference to array with different length"  
description: "Create new reference to array with different length"  
author: "Anonymous User"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1598/create-new-reference-to-array-with-different-length  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Create new reference to array with different length

Given some [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net):

```
int[] array = new int[8000];
```

Is it possible to refer to a new array such that:

```
int[] array2 = Array.SameReferenceDifferentLength(array, 4000);
```

## Replies

### Reply by Anonymous User

```
var a = new string[] { "a", "b", "c", "d", "e" };
var b = new ArraySegment<string>(a, 1, 3);
foreach (var s in b){
    Console.WriteLine(s);
}
```

This makes a shallow reference to the specified range of the array. That is, it doesn't copy the array data.

If you want to index an ArraySegment<T>, you can cast it to a IList<T> then use the indexer provided by that interface.


---

Original Source: https://www.mindstick.com/forum/1598/create-new-reference-to-array-with-different-length

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
