开发者

Why can I not decompile the DataRowExtensions methods with .NET Reflector?

When I load

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.DataSetExtensions.dll

in .NET Reflector (soon to be replaced by ILSpy), and open System.Data.DataRowExtensions, when I look at the method Field<T>(DataRow,DataColumn):T, the C# source code is just:

public static T Field<T>(this DataRow row, DataColumn column)
{
}
开发者_运维百科

I was expecting to see at least one line of code in the method like:

return (T)row[column];

Why would the method appear empty as in the first code example?


The assemblies in C:\Program Files\Reference Assemblies are for "reference" only, and are used by Visual Studio to support multi-targeting. The don't generally contain any implementation details, just the members.

Similar to this question and this one.

You would need to load the real assembly to see the implementation. Generally, when debugging you can see where the assemblies are located, if you can't find them.


I can see the method in both

  • C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll
  • C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\System.Data.DataSetExtensions.dll

.

public static T Field<T>(this DataRow row, DataColumn column)
{
    DataSetUtil.CheckArgumentNull<DataRow>(row, "row");
    return UnboxT<T>.Unbox(row[column]);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜