c# - Is it possible to wrap integer and call it like integer? -


I IDictionary & lt; Int, driver & gt; I want to make it a bit less ambiguous in , so I thought maybe wrapping it would be a good idea. Results IDictionary & lt; FinishPosition, Driver & gt; . Something like

, finishPosition should be assigned such as finishPosition = 1 .

I do not know how this is possible and how.

You have structure with a built-in conversion.

  public structure FinishPosition {public reading int position; Public Finnish term (status of int) {this.position = position; } Public stable underlying operative FinishPosition (int position) {New FinishPosition return (status); }} // ... Dictionary & lt; FinishPosition, Driver & gt; Dict = new dictionary & lt; FinishPosition, Driver & gt; (); Driver Bob = new driver (); // The following two lines are effectively equivalent [New FinnishPosition (7)] = Bob; Instructions [7] = Bob; // so these are two Bob = dec [7]; Bob = Dick [New FinnishPosition (7)]    

Comments