You are creating a class that performs complex financial calculations. The class contains a
method named GetCurrentRate that retrieves the current interest rate and a variable named
currRate that stores the current interest rate.
You write serialized representations of the class.
You need to write a code segment that updates the currRate variable with the current interest rate
when an instance of the class is deserialized. Which code segment should you use?
A. [OnSerializing]void UpdateValue (StreamingContext^ context) {
currRate = GetCurrentRate();}
B. [OnSerializing]void UpdateValue(SerializationInfo^ info) {
info->AddValue(“currentRate”, GetCurrentRate());}
C. [OnDeserializing]void UpdateValue(SerializationInfo^ info) {
info->AddValue(“currentRate”, GetCurrentRate());}
D. [OnDeserialized]void UpdateValue(StreamingContext^ context) {
currRate = GetCurrentRate();}
Answer: D
method named GetCurrentRate that retrieves the current interest rate and a variable named
currRate that stores the current interest rate.
You write serialized representations of the class.
You need to write a code segment that updates the currRate variable with the current interest rate
when an instance of the class is deserialized. Which code segment should you use?
A. [OnSerializing]void UpdateValue (StreamingContext^ context) {
currRate = GetCurrentRate();}
B. [OnSerializing]void UpdateValue(SerializationInfo^ info) {
info->AddValue(“currentRate”, GetCurrentRate());}
C. [OnDeserializing]void UpdateValue(SerializationInfo^ info) {
info->AddValue(“currentRate”, GetCurrentRate());}
D. [OnDeserialized]void UpdateValue(StreamingContext^ context) {
currRate = GetCurrentRate();}
Answer: D
No comments:
Post a Comment