public static void SetLicenseType(Vehicles io_Vehicle) { Utils.LicenseTypes LicenseType; System.Type vehicleType = io_Vehicle.GetType(); PropertyInfo propertyInfo = vehicleType.GetProperty("LicenseType"); if (propertyInfo != null) { LicenseType = GarageUI.GetLicenseType(); propertyInfo.SetValue(io_Vehicle, LicenseType, null); } }