• C# 字符串类型转换


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Threading;

    namespace CTest
    {
      class Program
      {
        static void Main(string[] args)
        {
        ... ...
        }
      }
    }

    //Threading
    using System.Threading;

    Thread.Sleep(1000);


    //Value types
    Console.WriteLine("Size of int:{0}", sizeof(int);
    Console.WriteLine();

    //输出结果:4


    //字符串(String)类型的值可以通过两种形式进行分配:引号和 @引号
    string str ="CTest.cc";
    @"CTest.cc";


    //C# string 字符串的前面可以加 @(称作"逐字字符串")将转义字符()当作普通字符对待
    string str = @"C:Windows";
    string str = "C:\Windows";

    //C#类型转换 - 显示类型转换
    double d = 5673.25;
    int i;
    //强制转换 double 为 int
    i = (int)d;
    Console.WriteLine(i);
    Thread.Sleep(1000);
    Console.WriteLine();

    //输出结果:5673

    Nothing is impossible, if you set your mind to it !
  • 相关阅读:
    笔记本
    物料主档建立(PP模组)
    烦!烦!烦!
    Windows Live Writer试用
    SAP系统中发送公告的几种办法
    [CSS样式表之] 渐变色的实现
    今天终于开通了这个博客了
    MFC消息映射机制过程
    绘图
    C++ 内存分配和指针
  • 原文地址:https://www.cnblogs.com/penny1141/p/4403411.html
Copyright © 2020-2023  润新知