易截截图软件、单文件、免安装、纯绿色、仅160KB

C#中ref参数与out参数的区别

先贴代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ref_and_Out_test
{
    class Program
    {
        static void Main(string[] args)
        {
            int a =0;        //若不初始化b会产生编译时错误。使用未初始化变量
            int b = 1;      //即使不初始化b也没有问题;
            RefAndOut(ref a,out b);
            Console.WriteLine("after RefAndOut method process");
            Console.WriteLine("a={0},b={1}", a, b);
        }
        static void RefAndOut(ref int a,out int b)
        {
            //b = 1;             //若此处不进行初始化,则try to print b这个语句无法执行
            Console.WriteLine("before change ref a=0 and out b =1 value");
            //try to print b:Console.WriteLine("a={0},b={1}", a, b);
            Console.WriteLine("Now change the value,a to 123 ,b to 999");
            a = 123;
           b = 999;        //若在方法内不对b赋值,则会出现编译时错误提醒必须对b赋值
        &


相关文档:

asp.net C# 排列组合 非递归

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("/*\n------输出结果------------");
getSplit("ABCDEFG"); ......

oracle 时间类型 C#

在sql语句中涉及到时间类型时 若只想要日期  to_date('2007-7-8','yyyy-mm-dd')
  在C#中有datetime类型,代码说明一切
  DateTime dt = System.DateTime.Now;
string lsh;
lsh=string.Format("{0:yyyyMMddHHmmss}", dt);
DateTime dt = DateTime.Now;
Label1.Text = dt.To ......

C#与C/C++的区别的地方


编译:C程序直接编译成标准的二进制可执行的代码,但C#的源程序并不是被编译成二进制可执行的形式,而是一种中间语言(MSIL),类似JAVA中的字节码
结构体:C#的结构体与C++的结构体相似。但是C#的结构体与类是不同的,而且不支持继承。
预编译:C#中存在预编译的指令支持条件编译,警告,错误报告和编译行控制。其指令 ......

C#小Tip:Xml操作简明手册 2


2)如何创建一个xml文档
由于xml实质也只是一个文本文件,所以最简单你可以直接使用System.IO下的类生成一个文件,并存储成xml文件,当然,你需要手动保证该文件形式良好,比如必须有根元素、必须有关闭标签、必须正确嵌套等等。
 
如果你懒得自己去想文件的形式,可以使用System.Xml下的类。
 
Code
Xml ......

c# 支持XML序列化的泛型 Dictionary

/// <summary>
/// 支持XML序列化的泛型 Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号