点滴(二)

 1、
 #define TRACE_ON
using System;
using System.Diagnostics;

public class Trace
{
    [Conditional("TRACE_ON")]
    public static void Msg(string msg)
    {
        Console.WriteLine(msg);
    }
}

public class ProgramClass
{
    static void Main()
    {
        Trace.Msg("Now in Main...");
        Console.WriteLine("Done.");
    }
}
More info : http://msdn.microsoft.com/zh-cn/library/4xssyw96(VS.80).aspx
[Conditional("A"), Conditional("B")]
static void DoIfAorB()
{
    // ...
}
[Conditional("DEBUG")]
public class Documentation : System.Attribute
{
    string text;

    public Documentation(string text)
    {
        this.text = text;
    }
}
-------------------------------------------------------------
class SampleClass
{
    // This attribute will only be included if DEBUG is defined.
    [Documentation("This method displays an integer.")]
    static void DoWork(int i)
    {
        System.Console.WriteLine(i.ToString());
    }
}

2. 行列转换:PIVOT http://www.cnblogs.com/geovindu/archive/2010/04/16/1713366.html
3. Once we need to retrieve data beyond checkbox check status, don't use if Checked() except for OnChange. because once use change the check status, you will get undesired result.
4. string.IsNullOrEmpty((String)ViewState[VSNAME_VS1]) 
   (String)ViewState[VSNAME_VS1] can be null and will never get converting exception once while the viewstate is null.  

5. http://msdn.microsoft.com/en-us/magazine/cc300437.aspx
Nine Options for Managing Persistent User State in Your ASP.NET Application 6. How to persist state between pages? http://www.codeproject.com/KB/applications/persistentstatepage.aspx
posted @ 2010-04-16 10:54  Elaine Shi  阅读(142)  评论(0编辑  收藏  举报