日期:2014-05-18  浏览次数:20744 次

看到好多人不会贴代码,贴的代码没有缩进,很乱,不易阅读,现向大家讲一下如何贴代码,例如贴C#代码:
1\看到好多人不会贴代码,贴的代码没有缩进,很乱,不易阅读,现向大家讲一下如何贴代码,例如贴C#代码: 
 
2、在发贴的文本框上方单击“#”按钮,选择 C#
3、将要发的代码粘贴到【code=C#】和【/code】之间,这样发出来的代码就会像下面一样:

C# code

public class Test 
{
    
    public static void Main(String[] args)  
  {
       Test t = new Test();
  }

}




------解决方案--------------------
代码应当对齐:
C# code
public class Test 
{
    public static void Main(String[] args)  
    {
       Test t = new Test();
    }
}

------解决方案--------------------
C# code
public class Test 
{
    
    public static void Main(String[] args)  
  {
       Test t = new Test();
  }

}

------解决方案--------------------
C# code

public class Hello
{
     public static void Main(String[] args)
{
Cosole.Write(Hello);
}
}

------解决方案--------------------
C# code

public class student
{
  private string name;
    public student(string_name)
     {
       this.name=_name;
     }
}

------解决方案--------------------
应该这样!
C# code

public class student
{
  private string name;
    public student(string_name)
     {
       this.name=_name;
     }
}

------解决方案--------------------
C# code

public class Hello
{
     public static void Main(String[] args)
{
Cosole.Write(Hello);
}
}

------解决方案--------------------
C# code
public class Hello
{
     public static void Main(String[] args)
{
Cosole.Write(Hello);
}
}

------解决方案--------------------
C# code
public class Hello
{
     public static void Main(String[] args)
{
Cosole.Write(Hello);
}
}

------解决方案--------------------
C# code


var a = window.showModalDialog("aa.aspx"); 

alert(a); 


在aa.aspx中,做完操作后. 

window.returnValue = 123; 
window.close(); 
那么父窗口中的a就是123

------解决方案--------------------
C# code


class ProgrammBase
    {
        public class Programm
        {
            public string ProgrammId { get; set;}
            public string KontrollArtId { get; set; }
            public int Stichprobe { get; set; }

            public Programm(string programmId, string kontrollArtId, int stichprobe)
            {
                ProgrammId = programmId;
                KontrollArtId = kontrollArtId;
                Stichprobe = stichprobe;
            }

            public static IList<Programm> ProgrammList { get; set; }
        }
}

------解决方案--------------------
JScript code
function recommendCallback(recommends) {
    if (!recommends || recommends.length < 0) return;
    var j = Math.floor(recommends.length * Math.random());
    updateReplyItems();
    if (reply_items.length <= 0) return;
    var start = reply_items[0].replyId ? 0 : 1;
    var end = start + Math.min(recommends.length, Math.min(5, reply_items.length));
    for (var i = start; i < end; i++) {
        if (reply_items[i] && reply_items[i].recommend) {
            j = (j + 1) % recommends.length;
            var html = new Array();
            html.push("精华推荐:");
            html.push("<a href=\"");
            html.push(recommends[j].url);
            html.push("\" target=\"_blank\" onclick='LogClickCount(this,112);'>");
            html.push(recommends[j].title);
            html.push("</a>")