protected virtual int ResolvePid(Type type) { if (!PidCache.TryGetValue(type, out int pid)) { pid = AddToPidCache(type); } return(pid); }
protected virtual byte ResolvePid <T>() where T : class, IOBDData, new() { if (!PidCache.TryGetValue(typeof(T), out byte pid)) { pid = AddToPidCache <T>(); } return(pid); }
protected virtual byte ResolvePid <T>() where T : class, IOBDData, new() { byte pid; if (!PidCache.TryGetValue(typeof(T), out pid)) { T data = Activator.CreateInstance <T>(); pid = data.PID; PidCache.Add(typeof(T), pid); DataTypeCache.Add(pid, typeof(T)); } return(pid); }