在這裡,我們透過 IL 中繼語言的反組譯工具 ILSpy 來查看這三個 .NET 生態環境的內容。
.NET Framework
我們使用 ILSpy 工具,打開
C:\Windows\Microsoft.NET\Framework\v4.0.30319
目錄,找到 mscorlib.dll
這個檔案
接著展開其
mscorlib
節點,接著再展開 System.Collections.Generic
節點,就會看到 List<T>
節點,點擊這個節點,就會看到這個類別的原始 C# 原始程式碼。
PCL 可攜式類別庫
在這裡,我們使用 PCL Profile259 這個版本
我們使用 ILSpy 工具,打開
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\
目錄,這裡就是 Profile 259 會使用到的類別庫組件所在位置,找到 System.Collections.dll
這個檔案這個位置,可以從 Visual Studio 中,打開任意一個 PCL 可攜式專案,點選參考
>.NET
節點,從屬性視窗的路徑
中,就可以查到,如下圖所示

接著展開其
System.Collections
節點,接著再展開 System.Collections.Generic
節點,就會看到 List<T>
節點,點擊這個節點,就會看到這個類別的原始 C# 原始程式碼。
不過,在這裡,似乎你只看到了這個 List 類別的成員定義,而成員的方法似乎都沒有實做出來。

讓我們繼續使用 ILSpy 工具,打開
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\
目錄,這裡就是 Profile 259 會使用到的類別庫組件所在位置,找到 mscorlib.dll
這個檔案
當你點選剛剛開啟的 mscorlib.dll 的 的泛型型別,則真正實作的組件,將不會在這個組件內定義,而是使用了 Type Forwarding 類型轉送 技術,需要到其他的組件上來找到這個類別的實作定義。根據微軟官方文件上的描述:
mscorlib
節點,從右邊分割視窗中,您會看到這個敘述 [assembly: TypeForwardedTo(typeof(List<>))]
這表示,在執行時期,若你的專案中有使用這個 List型別轉送可讓您將某種型別移到其他組件,而不需重新編譯使用原始組件的應用程式

.NET Standard 標準類別庫
在這裡,請先下載 NETStandard.Library NuGet 套件到本機上,使用 zip 解壓縮工具,就可以解開這個
netstandard.library.2.0.0.nupkg
壓縮檔案。當你在 Visual Studio 內,打開任意 .NET Standard 標準類別庫,就會看到如下圖
我們使用 ILSpy 工具,打開解壓縮 (
netstandard.library.2.0.0.nupkg
壓縮檔案) 後的目錄 netstandard.library.2.0.0.nupkg\build\netstandard2.0\ref
,這裡就是 NETStandard.Library 會使用到的類別庫組件所在位置,找到 netstandard.dll
這個檔案
接著展開其
netstandard
節點,接著再展開 System.Collections.Generic
節點,就會看到 List<T>
節點,點擊這個節點,就會看到這個類別的原始 C# 原始程式碼。
不過,在這裡,似乎你只看到了這個 List 類別的成員定義,而成員的方法似乎都沒有實做出來。

讓我們繼續使用 ILSpy 工具,打開解壓縮 (
netstandard.library.2.0.0.nupkg
壓縮檔案) 後的目錄 netstandard.library.2.0.0.nupkg\build\netstandard2.0\ref
,這裡就是 NETStandard.Library 會使用到的類別庫組件所在位置,找到 mscorlib.dll
這個檔案
當你點選剛剛開啟的 mscorlib.dll 的 的泛型型別,則真正實作的組件,將不會在這個組件內定義,而是使用了 Type Forwarding 類型轉送 技術,需要到其他的組件上來找到這個類別的實作定義。根據微軟官方文件上的描述:
mscorlib
節點,從右邊分割視窗中,您會看到這個敘述 [assembly: TypeForwardedTo(typeof(List))]
這表示,在執行時期,若你的專案中有使用這個 List型別轉送可讓您將某種型別移到其他組件,而不需重新編譯使用原始組件的應用程式

總結
從上面的檢測過程,我們可以知道,不論 PCL 或者 .NET Standard 這兩個,他們使用的核心技術原則上是相同的,只不過對於中繼套件的使用方式與可以使用那些平台的 API 的規劃設定方式不同。
在 .NET Standard,中繼套件 (原始程式碼) 描述定義 (部分) 一個或多個 .NET 標準程式庫版本的程式庫集合,並且,以 NuGet 套件散發並由 NETStandard.Library 中繼套件參考的參考組件;而 PCL 的中繼套件則是存在於本機上的某個目錄中,這是隨著你的 Visual Studio 安裝的同時,也就會安裝進去的。
關於最後真正平台要使用各 API 實作,則是使用 Type Forwarding 類型轉送 技術,在執行階段,動態的進行使用真正實作的組件。