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

What is the difference between F...

Câu trả lời

The main differences between Func<string,string> and a custom delegate are:

Syntax

  • Func<string,string> is a built-in generic delegate in C# that represents a method with a string parameter and a string return type. It's defined as public delegate TResult Func<in T, out TResult>(T arg);
  • A custom delegate is defined using the delegate keyword, e.g. public delegate string StringTransformer(string input);

Flexibility

  • Func<string,string> is limited to methods with a string parameter and string return type.
  • A custom delegate can represent any method signature, e.g. taking multiple parameters of different types, returning void, etc.

Reusability

  • `Func<st...
senior

senior

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

middle

How encapsulation is implemented in C#?

middle

What is the difference between Virtual method and Abstract method?

middle

What is scope of a Internal member variable of a C# class?

Bình luận

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

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