Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class CarList : MonoBehaviour
- {
- public List<CarInfo> Cars;
- public CarInfo this[string id]
- {
- get
- {
- return Cars.Find(a => a.Id == id);
- }
- set
- {
- int index = Cars.FindIndex(a => a.Id == id);
- Cars[index] = value;
- }
- }
- public CarInfo this[int index]
- {
- get
- {
- return Cars[index];
- }
- set
- {
- Cars[index] = value;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement