zoukankan      html  css  js  c++  java
  • string是一种特殊的引用类型,当给其赋值时会初始化一个新的string,即new String();

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

    namespace TEST
    {
        class Program
        {
            static void Main(string[] args)
            {

                //Obj obj = new Obj();
                //Obj obj2 = obj;
                //obj.Value = "1";
                //obj.ID = 1;
                //Console.WriteLine("obj.value:"+obj.Value +"  ID:"+obj.ID);
                //Console.WriteLine("obj2.value:" + obj2.Value + "  ID:" + obj2.ID);

                //obj.Value = "11";
                //obj.ID = 22;
                //Console.WriteLine("obj.value:" + obj.Value + "  ID:" + obj.ID);
                //Console.WriteLine("obj2.value:" + obj2.Value + "  ID:" + obj2.ID);

                //obj2.Value = "111";
                //obj2.ID = 222;
                //Console.WriteLine("obj.value:" + obj.Value + "  ID:" + obj.ID);
                //Console.WriteLine("obj2.value:" + obj2.Value + "  ID:" + obj2.ID);


                string str1;
                string str2;//string是一种特殊的引用类型,当给其赋值时会初始化一个新的string,即new String();

                str1 = "string1";
                str2 = str1;
                Console.WriteLine("str1:" + str1);
                Console.WriteLine("str2:" + str2);

                str2 = "string2";
                Console.WriteLine("str1:" + str1);
                Console.WriteLine("str2:" + str2);  



                Console.Read();
            }
        }

        class Obj
        {
            public string Value;
            public int ID;
        }
    }

    参考资料:

    -------------------------------------------------------------------------------------------------------------------------------------------------
    数据库优化
    数据库教程
    数据库实战经验分享博客

    百度云下载

    评测


  • 相关阅读:
    使用CSS3制图
    hdu4585 & BestCoder Round #1 项目管理(vector应用)
    ZooKeeperEclipse 小工具
    svn代码统计工具的金额
    【教你zencart仿站 文章1至6教训 高清1280x900视频下载】[支持手机端]
    [Django]models定义choices 字典中的页面显示值
    xml publisher根据条件显示或隐藏列
    hdu 1398 Square Coins(生成函数,完全背包)
    ubuntu软件中心崩溃
    PHP socket类
  • 原文地址:https://www.cnblogs.com/longle/p/2915633.html
Copyright © 2011-2022 走看看