The IndexBuffer defindes primitives by referencing the vertex data stored in vertexBuffer.
So without a IndexBuffer you need 6 Vertices to generate this "mesh":
That means you submit 6 Vertices to the GPU - for this case that is not much, but imagine you have a fully Scene with lots of meshes....
With a IndexBuffer in your pocket the Picture look like:
you only need 4 Vertices in the VertexBuffer for generating the same result.
So you use the IndexBuffer as a reference how the InputAssembler read the VertexBuffer to generate (in this case) 2 Triangles.
So the IndexBuffer tell to the InputAssembler like:
Hey, here you have a VertexBuffer with 4 Vertices, i gave you a reference how you can assembly 2 triangles with this 4 vertices, look:
For the first, you need
the First Item from the VertexBuffer (0)
than you grab the second Item (1)
and at least you need the fourth(3) Item from the buffer to form the First Triangle.
For the second Triangle, you need
The fourth Vertex(3).
the second Vertex (1)
and the third Vertex (2) to form the second Triangle.
So you must think, the IndexBuffer is more like a Blueprint to gave the IA the reference how connect Vertices - the benefit is you send less Data to the GPU
Sorry for the drawing, im not a professional, hope you can understand what i mean, feel free to ask.
For the pro´s, if this is complete garbage than GC.Collect() and tell me what i said wrong :) - always learning..