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

middle

What is the difference between Interface and Abstract Class?

middle

What is difference between constant and readonly ?

middle

Why can't you specify the accessibility modifier for methods inside the Interface?

Bình luận

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

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