Consider the following code segment:
{
Var exampleObject = new ExampleClass() ;
Try
{
ExampleObject.SomeMethod() ;
}
Finally
{
If (exampleObject != null)
{
ExampleObject.Dispose() ;
}
}
}
Which of the following using statements is equivalent to the preceding code segment
A) try using (var exampleObject = new ExampleClass() )
{
ExampleObject.SomeMethod() ; // do something with exampleObject
}
B) using (var exampleObject = new ExampleClass() )
{
ExampleObject.SomeMethod() ; // do something with exampleObject
}
C) using (var exampleObject = new ExampleClass() )
{
ExampleObject.SomeMethod() ; // do something with exampleObject
ExampleObject.Dispose() ;
}
D) try using (var exampleObject = new ExampleClass() )
{
ExampleObject.SomeMethod() ; // do something with exampleObject
ExampleObject.Dispose() ;
}
Correct Answer:
Verified
Q48: Resource de-allocation should be done explicitly in
Q49: Which of the following is not a
Q50: User-defined exceptions should be derived from the:
A)
Q51: Which of the following statements is false
A)
Q52: There can be no code in between
Q53: The finally block is executed only if
Q54: The process that attempts to locate an
Q55: Which of the following statements is false
A)
Q56: Which of the following statements is false
A)
Q57: Which of the following statements is false
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents