如何查看C#内置方法的源代码 [英] How Can I See Source Code Of C# Built In Methods
问题描述
例如:
Convert.ToInt32()
这个方法将值转换为int,是否可以看到由microsoft编写的这个方法的源代码。
感谢大家的回复,我需要在我的问题中添加更多细节。
我可以在微软网站上获取任何方法的源代码。
但我怎么看内部实现的方法
例如:
如何找到我不知道的方法的源代码他们属于的班级
ie
int i = ' x';
这里char'x'被隐式转换对我我得到x的ASCII值。
我可以找到它的实现
希望你能理解这个问题。
是的,你可以找到方法这里 [ ^ ]。
此外,您还可以使用以下VS扩展在VS中执行此操作:
Ref12 [ ^ ]
是的,您可以访问.NET库的源代码。请参阅: http://referencesource.microsoft.com [ ^ ]。
另请参阅我对问题的评论。而不是转换
,使用解析方法,如int.Parse
和int.TryParse
。转换
类在其他情况下很有用。
-SA
For example:
Convert.ToInt32()
this method converts the value to int, is it possible to see the source code of this method which is written by microsoft.
Thanks to all for your response, I need to add more details to my question.
I can get the souce code of any method on microsoft site.
But how i can see the methods which are internally implemented
for ex:
How i can find the source code of methods which i don't know to which class they belong
i.e
int i='x';
here char 'x' is implicitly converted to i. The i gets the ASCII value of x.
Where i can find its implementation
Hope you understand the question.
Yes it is possible, you can find the method here[^].
Also you can use the following VS extension to do this inside a VS as well:
Ref12[^]
Yes, you can get access to the source code of .NET libraries. Please see: http://referencesource.microsoft.com[^].
See also my comment to the question. Instead ofConvert
, use parsing methods likeint.Parse
andint.TryParse
.Convert
class is useful in number of other cases.
—SA
这篇关于如何查看C#内置方法的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!