Tanoda
Leap.Unity.IIndexableStruct< T, ThisIndexableType > Interface Template Reference

This is a definition-friendly interface that new "indexable" struct definitions can implement to make it a little easier to implement foreach and Query() operations for their struct. (You can use the IndexableStructEnumerator for this purpose, you just have to pass it type arguments that correspond to your struct type.) More...

Properties

this[int idx] [get]
 
int Count [get]
 

Detailed Description

This is a definition-friendly interface that new "indexable" struct definitions can implement to make it a little easier to implement foreach and Query() operations for their struct. (You can use the IndexableStructEnumerator for this purpose, you just have to pass it type arguments that correspond to your struct type.)

Unlike IIndexable, IIndexableStruct cannot utilize extension methods to automatically give consumers of the interface access to foreach and Query operations because consumption of a struct via an interface parameter forces the struct to be boxed, which causes allocation. As such, IIndexableStruct does not directly implement IIndexable.

(This all may change in C# 8 when we get traits, but Unity is still in the C# 4 stone age.)

Type Constraints
ThisIndexableType :struct 
ThisIndexableType :IIndexableStruct 
ThisIndexableType :T 
ThisIndexableType :ThisIndexableType 

Definition at line 29 of file IIndexableStruct.cs.

Property Documentation

◆ Count

int Leap.Unity.IIndexableStruct< T, ThisIndexableType >.Count
get

Definition at line 35 of file IIndexableStruct.cs.

◆ this[int idx]

T Leap.Unity.IIndexableStruct< T, ThisIndexableType >.this[int idx]
get

Definition at line 33 of file IIndexableStruct.cs.


The documentation for this interface was generated from the following file: