In the context of C#, .Net 4...
Given a data source object that supplies vertices by index from an array of doubles where a vertex contains ten doubles with members Px, Py, Pz, Nx, Ny, Nz, S, T, U, V. and the backing array contains all or any subset of vertex members based on the data source's stride, offset and count properties. The data source could be simplified as:
public class DataSource
{
private double[] data;
private int offset, stride, count;
public double[] ElementAt(int index)
{
double[] result = new double[count];
var relativeIndex = index * stride + offset;
Array.Copy(data, relativeIndex, result, 0, count);
return result;
}
.
.
.
}
Some consumers would be interested in a return type of double[], but most would request data as a PointNf type where N is the number of vertex members taken (Point1f...Point10f). The Point type consumer does not care for the source's stride and the source supplies a zero for members greater than its stride. e.g. Point4f from a source of stride 3 would be filled with data[i + 0], data[i + 1], data[i + 2], 0.
Obviously DataSource could expose methods GetPoint1f(int index), GetPoint2f(int index) and the like. These types of solutions might be best given the fixed set of return types, element size, etc. However...
What are possible solutions if a syntax like…
Point3f point = SomeDataSource.ElementAt[index];
...or similar was requested/required/desired ?...pros/cons ?...examples of what not to do ?...harsh language ?