Câu hỏi phỏng vấn C#
Câu hỏi

What is lambda expressions in C#?

Câu trả lời

Lambda expressions in C# are anonymous functions that can be used to create delegates or expression tree types. They provide a concise syntax for defining methods without explicitly declaring a named method[1][2][3].

The syntax for a lambda expression is:

(input-parameters) => expression

or

(input-parameters) => { <sequence-of-statements> }

The left side specifies the input parameters (if any) and the right side is the expression or statement block[4].

Some key points about lambda expressions:

  • They are used to create anonymous functions that can be passed as arguments to methods or assigned to variables[1][2]
  • The types of the input parameters can be explicitly specified or inferred by the compiler[4]
  • They can be converted to delegate types like Func or Action based on the parameter and return types[4]
  • They are commonly used ...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What are Reference Types in C#?

expert

You have defined a destructor in a class that you have developed by using the C#, but the destructor
never executed. Why?

junior

In how many ways you can pass parameters to a method?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào