Question 59 of 103 from exam MB-500: Microsoft Dynamics 365: Finance and Operations Apps Developer

Question 59 of 103 from exam MB-500: Microsoft Dynamics 365: Finance and Operations Apps Developer

Question

HOTSPOT - You have the following class definition:

class UnitConv

{

public static real PoundsToKilograms(real _pounds)

{

return _pounds * @.45359237;

}

public static real FahrenheitCelsius(real _fahrenheit)

{

return (_fahrenheit - 32) = 5/9;

You need to create an extension class and create a new static method in it that converts miles to kilometers and then call the method from another class.

How should you complete the code and call the method? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

Answer Area
Extension class definition:

[Extensionof (classStr(UnitConv) )]

a

final class CustUnitConv_Extension
final class UnitConv_MyExtension
static class UnitConvMy_Extension
class UnitConv_Extension

{

public static CaseMileage MiToKm(CaseMileage _miles)
i
return miles * 1.609344;
}
}

Call the method:

var km = UnitConv::MiToKm(62.1371);

CaseMileage km = UnitConv_MyExtension::MiToKm(62.1371);
UnitConvMy_Extension cUC = new UnitConv(); int km = cUC.MiToKm(62.1371);
UnitConv_Extension uCE = new UnitConv(); real km = uCE.MiToKm(62.1371);

Explanations

Answer Area
Extension class definition:

[Extensionof (classStr(UnitConv) )]

a

final class CustUnitConv_Extension
final class UnitConv_MyExtension
static class UnitConvMy_Extension
class UnitConv_Extension

{

public static CaseMileage MiToKm(CaseMileage _miles)
i
return miles * 1.609344;
}
}

Call the method:

var km = UnitConv::MiToKm(62.1371);
CaseMileage km = UnitConv_MyExtension::MiToKm(62.1371);

UnitConvMy_Extension cUC = new UnitConv(); int km = cUC.MiToKm(62.1371);
UnitConv_Extension uCE = new UnitConv(); real km = uCE.MiToKm(62.1371);

Box 1: final class UnitConv_MyExtension Box 2: var km = UnitConv::miToKm(62.1371); Reference: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc.