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:

Copy
(input-parameters) => expression

or

Copy
(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

expert

Explain the difference between IQueryable , ICollection , IList & IDictionary interfaces?

middle

What is the difference between Interface and Abstract Class?

senior

What happens when we Box or Unbox Nullable types?

Bình luận

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

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