Solved

Consider the Following Code Segment

Question 58

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents