If it's 0-based, how can we add a placeholder to make it 1-based? Thank you.
it is 0 based. if you want to make it 1 based why not make a read method which accepts an index removes one and then use that and return the value?
It is 0-based. A return question might be: why do you want to make it 1-based?
With Extension Methods you could (if you wanted) do:
<Extension()>
Public Function GetOneBased(Of T)(ByVal list As IList(Of T), ByVal index As Integer) As T
Return list(index-1)
End Function
<Extension()>
Public Sub SetOneBased(Of T)(ByVal list As IList(Of T), ByVal index As Integer, ByVal value As T)
list(index-1) = value
End Sub
then use (from almost any collection):
Dim foo = data.GetOneBased(1)
data.SetOneBased(1, bar)
You can use Insert( int index, T item ) to insert an item at position 0, but I think you'd be better off doing index arithmetic and referencing as a 0-based collection. This is what most programmers coming after you will expect. @Robert's extension method idea has some value, but I think will end up confusing the eventual maintainers of your code.
Why would you want to make it 1-based? Arrays in VB.Net used 0-based indexes as well.