@@ -165,114 +165,54 @@ public static ApparentPower Zero
165
165
/// <summary>
166
166
/// Get ApparentPower from Kilovoltamperes.
167
167
/// </summary>
168
- #if NETFX_CORE
168
+ #if WINDOWS_UWP
169
169
[ Windows . Foundation . Metadata . DefaultOverload ]
170
- #endif
171
170
public static ApparentPower FromKilovoltamperes ( double kilovoltamperes )
172
171
{
173
- return new ApparentPower ( ( kilovoltamperes ) * 1e3d ) ;
174
- }
175
-
176
- /// <summary>
177
- /// Get ApparentPower from Kilovoltamperes.
178
- /// </summary>
179
- public static ApparentPower FromKilovoltamperes ( int kilovoltamperes )
180
- {
181
- return new ApparentPower ( ( kilovoltamperes ) * 1e3d ) ;
182
- }
183
-
184
- /// <summary>
185
- /// Get ApparentPower from Kilovoltamperes.
186
- /// </summary>
187
- public static ApparentPower FromKilovoltamperes ( long kilovoltamperes )
188
- {
189
- return new ApparentPower ( ( kilovoltamperes ) * 1e3d ) ;
172
+ double value = ( double ) kilovoltamperes ;
173
+ return new ApparentPower ( ( value ) * 1e3d ) ;
190
174
}
191
-
192
- // Windows Runtime Component does not support decimal type
193
- #if ! WINDOWS_UWP
194
- /// <summary>
195
- /// Get ApparentPower from Kilovoltamperes of type decimal.
196
- /// </summary>
197
- public static ApparentPower FromKilovoltamperes ( decimal kilovoltamperes )
175
+ #else
176
+ public static ApparentPower FromKilovoltamperes ( QuantityValue kilovoltamperes )
198
177
{
199
- return new ApparentPower ( ( Convert . ToDouble ( kilovoltamperes ) ) * 1e3d ) ;
178
+ double value = ( double ) kilovoltamperes ;
179
+ return new ApparentPower ( ( ( value ) * 1e3d ) ) ;
200
180
}
201
181
#endif
202
182
203
183
/// <summary>
204
184
/// Get ApparentPower from Megavoltamperes.
205
185
/// </summary>
206
- #if NETFX_CORE
186
+ #if WINDOWS_UWP
207
187
[ Windows . Foundation . Metadata . DefaultOverload ]
208
- #endif
209
188
public static ApparentPower FromMegavoltamperes ( double megavoltamperes )
210
189
{
211
- return new ApparentPower ( ( megavoltamperes ) * 1e6d ) ;
190
+ double value = ( double ) megavoltamperes ;
191
+ return new ApparentPower ( ( value ) * 1e6d ) ;
212
192
}
213
-
214
- /// <summary>
215
- /// Get ApparentPower from Megavoltamperes.
216
- /// </summary>
217
- public static ApparentPower FromMegavoltamperes ( int megavoltamperes )
218
- {
219
- return new ApparentPower ( ( megavoltamperes ) * 1e6d ) ;
220
- }
221
-
222
- /// <summary>
223
- /// Get ApparentPower from Megavoltamperes.
224
- /// </summary>
225
- public static ApparentPower FromMegavoltamperes ( long megavoltamperes )
226
- {
227
- return new ApparentPower ( ( megavoltamperes ) * 1e6d ) ;
228
- }
229
-
230
- // Windows Runtime Component does not support decimal type
231
- #if ! WINDOWS_UWP
232
- /// <summary>
233
- /// Get ApparentPower from Megavoltamperes of type decimal.
234
- /// </summary>
235
- public static ApparentPower FromMegavoltamperes ( decimal megavoltamperes )
193
+ #else
194
+ public static ApparentPower FromMegavoltamperes ( QuantityValue megavoltamperes )
236
195
{
237
- return new ApparentPower ( ( Convert . ToDouble ( megavoltamperes ) ) * 1e6d ) ;
196
+ double value = ( double ) megavoltamperes ;
197
+ return new ApparentPower ( ( ( value ) * 1e6d ) ) ;
238
198
}
239
199
#endif
240
200
241
201
/// <summary>
242
202
/// Get ApparentPower from Voltamperes.
243
203
/// </summary>
244
- #if NETFX_CORE
204
+ #if WINDOWS_UWP
245
205
[ Windows . Foundation . Metadata . DefaultOverload ]
246
- #endif
247
206
public static ApparentPower FromVoltamperes ( double voltamperes )
248
207
{
249
- return new ApparentPower ( voltamperes ) ;
250
- }
251
-
252
- /// <summary>
253
- /// Get ApparentPower from Voltamperes.
254
- /// </summary>
255
- public static ApparentPower FromVoltamperes ( int voltamperes )
256
- {
257
- return new ApparentPower ( voltamperes ) ;
258
- }
259
-
260
- /// <summary>
261
- /// Get ApparentPower from Voltamperes.
262
- /// </summary>
263
- public static ApparentPower FromVoltamperes ( long voltamperes )
264
- {
265
- return new ApparentPower ( voltamperes ) ;
208
+ double value = ( double ) voltamperes ;
209
+ return new ApparentPower ( value ) ;
266
210
}
267
-
268
- // Windows Runtime Component does not support decimal type
269
- #if ! WINDOWS_UWP
270
- /// <summary>
271
- /// Get ApparentPower from Voltamperes of type decimal.
272
- /// </summary>
273
- public static ApparentPower FromVoltamperes ( decimal voltamperes )
211
+ #else
212
+ public static ApparentPower FromVoltamperes ( QuantityValue voltamperes )
274
213
{
275
- return new ApparentPower ( Convert . ToDouble ( voltamperes ) ) ;
214
+ double value = ( double ) voltamperes ;
215
+ return new ApparentPower ( ( value ) ) ;
276
216
}
277
217
#endif
278
218
@@ -281,7 +221,7 @@ public static ApparentPower FromVoltamperes(decimal voltamperes)
281
221
/// <summary>
282
222
/// Get nullable ApparentPower from nullable Kilovoltamperes.
283
223
/// </summary>
284
- public static ApparentPower ? FromKilovoltamperes ( double ? kilovoltamperes )
224
+ public static ApparentPower ? FromKilovoltamperes ( QuantityValue ? kilovoltamperes )
285
225
{
286
226
if ( kilovoltamperes . HasValue )
287
227
{
@@ -293,70 +233,10 @@ public static ApparentPower FromVoltamperes(decimal voltamperes)
293
233
}
294
234
}
295
235
296
- /// <summary>
297
- /// Get nullable ApparentPower from nullable Kilovoltamperes.
298
- /// </summary>
299
- public static ApparentPower ? FromKilovoltamperes ( int ? kilovoltamperes )
300
- {
301
- if ( kilovoltamperes . HasValue )
302
- {
303
- return FromKilovoltamperes ( kilovoltamperes . Value ) ;
304
- }
305
- else
306
- {
307
- return null ;
308
- }
309
- }
310
-
311
- /// <summary>
312
- /// Get nullable ApparentPower from nullable Kilovoltamperes.
313
- /// </summary>
314
- public static ApparentPower ? FromKilovoltamperes ( long ? kilovoltamperes )
315
- {
316
- if ( kilovoltamperes . HasValue )
317
- {
318
- return FromKilovoltamperes ( kilovoltamperes . Value ) ;
319
- }
320
- else
321
- {
322
- return null ;
323
- }
324
- }
325
-
326
- /// <summary>
327
- /// Get nullable ApparentPower from Kilovoltamperes of type decimal.
328
- /// </summary>
329
- public static ApparentPower ? FromKilovoltamperes ( decimal ? kilovoltamperes )
330
- {
331
- if ( kilovoltamperes . HasValue )
332
- {
333
- return FromKilovoltamperes ( kilovoltamperes . Value ) ;
334
- }
335
- else
336
- {
337
- return null ;
338
- }
339
- }
340
-
341
- /// <summary>
342
- /// Get nullable ApparentPower from nullable Megavoltamperes.
343
- /// </summary>
344
- public static ApparentPower ? FromMegavoltamperes ( double ? megavoltamperes )
345
- {
346
- if ( megavoltamperes . HasValue )
347
- {
348
- return FromMegavoltamperes ( megavoltamperes . Value ) ;
349
- }
350
- else
351
- {
352
- return null ;
353
- }
354
- }
355
-
356
236
/// <summary>
357
237
/// Get nullable ApparentPower from nullable Megavoltamperes.
358
238
/// </summary>
359
- public static ApparentPower ? FromMegavoltamperes ( int ? megavoltamperes )
239
+ public static ApparentPower ? FromMegavoltamperes ( QuantityValue ? megavoltamperes )
360
240
{
361
241
if ( megavoltamperes . HasValue )
362
242
{
@@ -368,85 +248,10 @@ public static ApparentPower FromVoltamperes(decimal voltamperes)
368
248
}
369
249
}
370
250
371
- /// <summary>
372
- /// Get nullable ApparentPower from nullable Megavoltamperes.
373
- /// </summary>
374
- public static ApparentPower ? FromMegavoltamperes ( long ? megavoltamperes )
375
- {
376
- if ( megavoltamperes . HasValue )
377
- {
378
- return FromMegavoltamperes ( megavoltamperes . Value ) ;
379
- }
380
- else
381
- {
382
- return null ;
383
- }
384
- }
385
-
386
- /// <summary>
387
- /// Get nullable ApparentPower from Megavoltamperes of type decimal.
388
- /// </summary>
389
- public static ApparentPower ? FromMegavoltamperes ( decimal ? megavoltamperes )
390
- {
391
- if ( megavoltamperes . HasValue )
392
- {
393
- return FromMegavoltamperes ( megavoltamperes . Value ) ;
394
- }
395
- else
396
- {
397
- return null ;
398
- }
399
- }
400
-
401
- /// <summary>
402
- /// Get nullable ApparentPower from nullable Voltamperes.
403
- /// </summary>
404
- public static ApparentPower ? FromVoltamperes ( double ? voltamperes )
405
- {
406
- if ( voltamperes . HasValue )
407
- {
408
- return FromVoltamperes ( voltamperes . Value ) ;
409
- }
410
- else
411
- {
412
- return null ;
413
- }
414
- }
415
-
416
- /// <summary>
417
- /// Get nullable ApparentPower from nullable Voltamperes.
418
- /// </summary>
419
- public static ApparentPower ? FromVoltamperes ( int ? voltamperes )
420
- {
421
- if ( voltamperes . HasValue )
422
- {
423
- return FromVoltamperes ( voltamperes . Value ) ;
424
- }
425
- else
426
- {
427
- return null ;
428
- }
429
- }
430
-
431
251
/// <summary>
432
252
/// Get nullable ApparentPower from nullable Voltamperes.
433
253
/// </summary>
434
- public static ApparentPower ? FromVoltamperes ( long ? voltamperes )
435
- {
436
- if ( voltamperes . HasValue )
437
- {
438
- return FromVoltamperes ( voltamperes . Value ) ;
439
- }
440
- else
441
- {
442
- return null ;
443
- }
444
- }
445
-
446
- /// <summary>
447
- /// Get nullable ApparentPower from Voltamperes of type decimal.
448
- /// </summary>
449
- public static ApparentPower ? FromVoltamperes ( decimal ? voltamperes )
254
+ public static ApparentPower ? FromVoltamperes ( QuantityValue ? voltamperes )
450
255
{
451
256
if ( voltamperes . HasValue )
452
257
{
@@ -463,19 +268,25 @@ public static ApparentPower FromVoltamperes(decimal voltamperes)
463
268
/// <summary>
464
269
/// Dynamically convert from value and unit enum <see cref="ApparentPowerUnit" /> to <see cref="ApparentPower" />.
465
270
/// </summary>
466
- /// <param name="val ">Value to convert from.</param>
271
+ /// <param name="value ">Value to convert from.</param>
467
272
/// <param name="fromUnit">Unit to convert from.</param>
468
273
/// <returns>ApparentPower unit value.</returns>
469
- public static ApparentPower From ( double val , ApparentPowerUnit fromUnit )
274
+ #if WINDOWS_UWP
275
+ // Fix name conflict with parameter "value"
276
+ [ return : System . Runtime . InteropServices . WindowsRuntime . ReturnValueName ( "returnValue" ) ]
277
+ public static ApparentPower From ( double value , ApparentPowerUnit fromUnit )
278
+ #else
279
+ public static ApparentPower From ( QuantityValue value , ApparentPowerUnit fromUnit )
280
+ #endif
470
281
{
471
282
switch ( fromUnit )
472
283
{
473
284
case ApparentPowerUnit . Kilovoltampere :
474
- return FromKilovoltamperes ( val ) ;
285
+ return FromKilovoltamperes ( value ) ;
475
286
case ApparentPowerUnit . Megavoltampere :
476
- return FromMegavoltamperes ( val ) ;
287
+ return FromMegavoltamperes ( value ) ;
477
288
case ApparentPowerUnit . Voltampere :
478
- return FromVoltamperes ( val ) ;
289
+ return FromVoltamperes ( value ) ;
479
290
480
291
default :
481
292
throw new NotImplementedException ( "fromUnit: " + fromUnit ) ;
@@ -490,7 +301,7 @@ public static ApparentPower From(double val, ApparentPowerUnit fromUnit)
490
301
/// <param name="value">Value to convert from.</param>
491
302
/// <param name="fromUnit">Unit to convert from.</param>
492
303
/// <returns>ApparentPower unit value.</returns>
493
- public static ApparentPower ? From ( double ? value , ApparentPowerUnit fromUnit )
304
+ public static ApparentPower ? From ( QuantityValue ? value , ApparentPowerUnit fromUnit )
494
305
{
495
306
if ( ! value . HasValue )
496
307
{
0 commit comments