在C#中定义隐式和显式转换 [英] Define Implicit and Explicit Conversion in C#
本文介绍了在C#中定义隐式和显式转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我想知道隐式和显式Conversion Any Body可以帮助我
谢谢
Dreen
解决方案
搜索是否为您损坏?
隐含 [显式 [ // 隐式转换 int 总计= 100 ; 字符串 str = " ; Console.WriteLine(str + total); // 显式转换 对象 obj = 新 对象(); int i =( int )obj + 5 ;
http://msdn.microsoft.com/en-us/library/z5z9kes2 (v = vs.71).aspx [ http://msdn.microsoft.com/en-us/library/xhbhezf4 (v = vs.71).aspx [具有隐式和显式运算符的类型转换 [ ^ ]
Hello
I want to know implicit and explicit Conversion Any Body help me
Thanks
Dreen
解决方案
Search broken for you?
Implicit[^]
Explicit[^]
You really need to make more effort yourself.
Implicit conversion operators can be called implicitly, without being specified by explicit casts in the source code.
Unlike implicit conversion, explicit conversion operators must be invoked via a cast.
//Implicit conversion int total = 100; string str = "Total number is : "; Console.WriteLine(str + total); //Explicit Converion Object obj = new object(); int i = (int)obj + 5;
http://msdn.microsoft.com/en-us/library/z5z9kes2(v=vs.71).aspx[^]
http://msdn.microsoft.com/en-us/library/xhbhezf4(v=vs.71).aspx[^]
Codeproject is always the best source, refer here,
Type conversions with implicit and explicit operators[^]
这篇关于在C#中定义隐式和显式转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文