C#3

时间:2023-03-09 05:37:39
C#3

定义常量:1.静态常量 const(定义时必须初始化)  、、、常量都不可以改变

2.动态常量 readonly(定义时不必初始化) \\要在Main方法前面

用法:const double PI = 3.14       readonly double PI = 3.14

类型转换:隐式类型转换:低精度会自动转换为高精度 如int转为double

显示类型转换:double a=10; int c = (int)a;

或 int c = Convert.ToInt32(a);

或 int c = Int.Parse(a.ToString());  因为Parse 用于字符转为其他类型

随机推荐

  1. Unix Linux 编程书籍

    UNIX环境高级编程(第3版) Advanced Programming in the UNIX Environment Linux/UNIX系统编程手册 Linux/UNIX系统编程手册 (豆瓣) ...

  2. Python 统计IIS日志行数

    __author__ = 'Administrator' import codecs def blocks(file, size=65536): while True: b = file.read(s ...

  3. Iaas-cloudstack2

    流程是下面的模板安装脚本,将对应的hypervisor模板下载下来并另存为临时文件,并解压缩,并将其移动到二级存储相应目录下,仅完成此工作. [root@manage nfs]# /usr/share ...

  4. hibernate 自生双向一对多 多对一管理 (树)

    <span style="font-size: large;">package com.javacrazyer.test; import java.io.Seriali ...

  5. java将office文档pdf文档转换成swf文件在线预览

    第一步,安装openoffice.org openoffice.org是一套sun的开源office办公套件,能在widows,linux,solaris等操作系统上执行. 主要模块有writer(文 ...

  6. innertext与innerhtml

    <div id="test"> <span style="color:red">test1</span> test2 &lt ...

  7. SIM卡里的文件

    SIM卡里的所有文件按树来组织:主文件MF(Master File)——每一块SIM卡只有一个唯一的主文件, 其他所有文件都是它的子孙, 主文件只有文件头,里面存放着整个SIM卡的控制和管理信息专用文 ...

  8. CryptAPI 数字签名 与 Openssl 验证签名

    这段时间要实现一个认证协议,分为客户端和服务器端,客户端使用windows操作系统,服务器端使用linux操作系统,在客户端下(windows),使用windows证书库中的签名证书对消息进行签名(使 ...

  9. php 安装shpinx扩展

    cd /home/packages wget http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz tar xzvf sphinx-0.9.9.tar.g ...

  10. HackerRank "Morgan and a String"

    I saw the same sub-problem in LeetCode, and there exists a O(n) neat greedy solution: for _ in range ...