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

What is an anonymous function in C#?

Câu trả lời

An anonymous function in C# is a function that has no name and is defined without a formal method declaration. It is typically used when you need a simple function for a short period of time, such as when passing a function as an argument to another method or when using LINQ (Language Integrated Query) to query and manipulate data.

There are two main types of anonymous functions in C#:

Lambda Expressions

Lambda expressions are the most common form of anonymous functions in C#. They use the lambda operator (=>) to separate the function parameters from the function body. The syntax for a lambda expression is:

csharp Copy
(parameters) => expression

or

csharp Copy
(parameters) => { statements; }

Here's an example of a lambda exp...

middle

middle

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

expert

Could you explain the difference between destructor , dispose and finalize method?

expert

What is the volatile keyword used for?

senior

What is Marshalling and why do we need it?

Bình luận

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

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