×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What is the correct syntax for foreach statement in C#?

43. What is the correct syntax for foreach statement in C#?

  1. foreach(type variable_name in collection_name); {
      statement(s);
    }
    
  2. foreach(type variable_name in collection_name) {
      statement(s);
    }
    
  3. foreach(variable_name As Type in collection_name){
      statement(s);
    }
    
  4. foreach(dim type variable_name in collection_name) {
      statement(s);
    }
    

Answer: B)

foreach(type variable_name in collection_name) {
  statement(s);
}

Explanation:

The correct syntax of foreach statement is:

foreach(type variable_name in collection_name) {
  statement(s);
}

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.