Solved

Consider the Following Code Segment

Question 9

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