Câu hỏi phỏng vấn .NET Core
Câu hỏi

What is .NET Standard?

Câu trả lời

.NET Standard is a formal specification of .NET APIs that are available across multiple .NET implementations, such as .NET Framework, .NET Core, and Xamarin. It was created to establish greater uniformity in the .NET ecosystem by defining a common set of APIs that all .NET platforms must implement. This allows developers to create libraries that can be used across different .NET environments without compatibility issues.

Key Points about .NET Standard:

  1. Specification, Not Implementation:

    • .NET Standard is not a runtime or a framework itself; it is a specification that defines which APIs must be available in the Base Class Libraries (BCL) of different .NET implementations[2][3][8].
  2. Code Sharing:

    • The primary purpose of .NET Standard is to enable code sharing across different .NET platforms. By targeting .NET Standard, a library can be used in applications running on .NET Framework, .NET Core, Xamarin, and other .NET implementations[1][6][11].
  3. Versioning:

    • .NET Standard is versioned, with each new version adding more APIs. Higher versions of .NET Standard include all APIs from previous versions plus additional ones. This ensures backward compatibility and allows developers to target the lowest version that meets their needs to maximize compatibility across platforms[2][6][11].
  4. Compatibility:

    • Libraries targeting .NET Standard can run on any .NET implementation that supports the targeted .NET Standard version or higher. For example, a library targeting .NET Standard 2.0 can run on .NET Framework 4.6.1, .NET Core 2.0, and later versions[2][6][7].
  5. Transition to .NET 5 and Beyond:

    • With the release of .NET 5, Microsoft has unified the .NET platform, reducing the need for .NET Standard in many scenarios. However, .NET 5 and later versions still support .NET Standard 2.1 and earlier, ensuring continued compatibility for existing libraries[2][5].

Example Usage:

To target .NET Standard in a project, you specify the Target Framework Moniker (TFM) in the project file, like so:

xml Copy
<Project Sdk="M...
entry

entry

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

junior

What is a .NET application domain?

senior

Why does .NET use a JIT compiler instead of just compiling the code once on the target machine?

middle

Explain the use of BackgroundService class in Asp.Net Core?

Bình luận

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

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