当前在线人数17937
首页 - 分类讨论区 - 电脑网络 - 窗口里的风景版 -阅读文章
未名交友
[更多]
[更多]
文章阅读:C#.Net Funsdamentals (4)
[同主题阅读] [版面: 窗口里的风景] [作者:cogt] , 2007年01月03日09:32:11
cogt
进入未名形象秀
我的博客
[上篇] [下篇] [同主题上篇] [同主题下篇]

发信人: cogt (苦荆茶), 信区: DotNet
标  题: C#.Net Funsdamentals (4)
发信站: BBS 未名空间站 (Wed Jan  3 09:32:23 2007), 转信

ntroduction

C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-
safe programming language. It will immediately be familiar to C and C++
programmers. C# combines the high productivity of Rapid Application
Development (RAD) languages and the raw power of C++.

Conversions

The predefined types also have predefined conversions. For instance,
conversions exist between the predefined types int and long. C#
differentiates between two kinds of conversions: implicit conversions and
explicit conversions. Implicit conversions are supplied for conversions that
can safely be performed without careful scrutiny. For instance, the
conversion from int to long is an implicit conversion. This conversion
always succeeds, and never results in a loss of information. The following
example

using System;
class Test
{
  static void Main() {
     int intValue = 123;
     long longValue = intValue;
     Console.WriteLine("{0}, {1}", intValue, longValue);
  }
}
implicitly converts an int to a long.

In contrast, explicit conversions are performed with a cast expression. The
example

using System;
class Test
{
  static void Main() {
     long longValue = Int64.MaxValue;
     int intValue = (int) longValue;
     Console.WriteLine("(int){0} = {1}", longValue, intValue);
  }
}
uses an explicit conversion to convert a long to an int. The output is:

(int) 9223372036854775807 = -1
because an overflow occurs. Cast expressions permit the use of both implicit
and explicit conversions.


Summary


These will help u understand fundas of c#.net .. will continue






       

--

※ 来源:·BBS 未名空间站 mitbbs.com·[FROM: 216.99.]

[上篇] [下篇] [同主题上篇] [同主题下篇]
[转寄] [转贴] [回信给作者] [修改文章] [删除文章] [同主题阅读] [从此处展开] [返回版面] [快速返回] [收藏] [举报]
 
回复文章
标题:
内 容:

未名交友
将您的链接放在这儿

友情链接


 

Site Map - Contact Us - Terms and Conditions - Privacy Policy

版权所有,未名空间(mitbbs.com),since 1996