Which two statements about the sr and textFromFile variables are true?

You are an Independent Software Vendor (ISV) developer, and you are reviewing the code in a solution.

During the code review, you see the following:

using (var sr = new System.IO.StreamReader(_inputFilename))

{

var textFromFile = sr.ReadToEnd();

this.processFileDate(textFromFile);

}

Which two statements about the sr and textFromFile variables are true? Each correct answer presents a complete solution.
A . The variables storing .Net Framework objects have to be declared using the var keyword.
B . The var keyword indicates the variables can store values of any type.
C . The variables are valid within the block of code in which they were declared.
D . The var keyword infers the type of the variables from their initialization expression.

Answer: CD

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments