- C# 7 and .NET Core 2.0 High Performance
- Ovais Mehboob Ahmed Khan
- 265字
- 2021-08-27 18:47:08
Compatibility mode
Although more than 33K APIs have been added into .NET Standard 2.0, many of the NuGet packages still target .NET Framework, and moving them to .NET Standard is not possible, since their dependencies are still not targeted at .NET Standard. However, with .NET Standard 2.0, we can still add packages which show a warning but don't block adding those packages into our .NET Standard library.
Under the hood, .NET Standard 2.0 uses compatibility shim, which solves the third party library compatibility issue and makes it easy in referencing those libraries. In the CLR world, the identity of the assembly is part of the type identity. This means that when we say System.Object in .NET Framework, we are referencing [mscorlib]System.Object and with .NET Standard, we are referencing [netstandard]System.Object, so if we are referencing any assembly which is part of .NET Framework, it cannot be easily run on .NET Standard and so compatibility issues arise. To solve this problem, they have used type forwarding which provides a fake mscorlib assembly that type forwards all the types to the .NET Standard implementation.
Here is a representation of how the .NET Framework libraries can run in any of the .NET Standard implementations using the type forwarding approach:

On the other hand, if we have a .NET Framework library and we wanted to reference a .NET Standard library, it will add the netstandard fake assembly and perform type forwarding of all the types by using the .NET Framework implementation:

- 計算機綜合設(shè)計實驗指導(dǎo)
- 劍破冰山:Oracle開發(fā)藝術(shù)
- Effective Amazon Machine Learning
- 數(shù)據(jù)結(jié)構(gòu)與算法(C語言版)
- 數(shù)據(jù)庫原理與設(shè)計(第2版)
- Oracle 12c云數(shù)據(jù)庫備份與恢復(fù)技術(shù)
- 大數(shù)據(jù)技術(shù)入門
- Oracle RAC日記
- 重復(fù)數(shù)據(jù)刪除技術(shù):面向大數(shù)據(jù)管理的縮減技術(shù)
- Instant Autodesk AutoCAD 2014 Customization with .NET
- Hadoop 3實戰(zhàn)指南
- 貫通SQL Server 2008數(shù)據(jù)庫系統(tǒng)開發(fā)
- 大數(shù)據(jù)技術(shù)原理與應(yīng)用:概念、存儲、處理、分析與應(yīng)用
- Mastering ROS for Robotics Programming(Second Edition)
- 利用Python進行數(shù)據(jù)分析(原書第2版)