Time of Update: 2018-12-06
與C#一樣,java也對基本類型進行了封裝,int封裝出Integer類,boolean封裝出Boolean類。這樣一來,基本類型就突破了實值型別的限制,獲得了物件導向的好處。然而,與.NET不同,java中的封裝類是真正的參考型別,比如在java中用“==”比較兩個封裝類對象,儘管值相等,得到的結果也很可能是false,而不是像.NET一樣,將基本類型的一些操作符作了重載,使得“==”符號的行為看起來與基本類型完全一致。在java中,“Integer
Time of Update: 2018-12-06
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public void ExportExcel() { Response.Clear(); Response.Buffer = true; //Response.Charset="utf-8";
Time of Update: 2018-12-06
(1)NULLnull 關鍵字是表示不引用任何對象的Null 參考的文字值。null 是參考型別變數的預設值。那麼也只有引用型的變數可以為NULL,如果 int i=null,的話,是不可以的,因為Int是實值型別的。 (2)""和String.Empty 這兩個都是表示Null 字元串。只不過""理論上重新開闢記憶體空間,而String.Empty指向一處。不過最佳化器會最佳化的! string.Empty不分配儲存空間,
Time of Update: 2018-12-06
要在c#中擷取路徑有好多方法,一般常用的有以下五種: //擷取應用程式的當前工作目錄。 String path1 = System.IO.Directory.GetCurrentDirectory(); MessageBox.Show("擷取應用程式的當前工作目錄:" + path1); //擷取程式的基目錄。 String path2 = System.AppDomain.CurrentDomain.BaseDirectory;
Time of Update: 2018-12-06
c#跨線程使用控制項需要使用委託來實現 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading; 9 using System.Threading.Tasks;10
Time of Update: 2018-12-06
轉自:《模式——工程化實現及擴充》(設計模式C# 版) http://www.cnblogs.com/callwangxiang/ MarvellousWorks公司最近開始向大客戶提供後台接入服務,允許客戶通過該服務與其多個線上業務進行B2B整合。
Time of Update: 2018-12-06
轉自:《模式——工程化實現及擴充》(設計模式C# 版)
Time of Update: 2018-12-06
ASPX:<%@ Page %><HTML> <Title>使用全網站計數器</Title> <!--#Include file="GlobCount.inc"--> <script language="c#" runat="server">private void Page_Load(object sender, System.EventArgs e){ if(!IsPostBack)
Time of Update: 2018-12-06
Console.WriteLine(Evaluator.Eval("1+2+3+4+5+6+7+8+9"));//45Console.WriteLine(Evaluator.Eval("(1+1)/2*3"));Console.WriteLine(Evaluator.Eval("((10-2)/2+1)*3"));//15 using System;using System.Collections.Generic;using System.Linq;using System.Text;using
Time of Update: 2018-12-06
代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
1. string.Empty==" " !=null,所以在判斷string類型變數時,最好使用string.IsNullOrEmpty();2. string 與 String 的區別: (1). string是c#中的類,String是.net Framework的類(在c# IDE中不會顯示藍色),c# string映射為.net
Time of Update: 2018-12-06
1、 裝箱和拆箱是一個抽象的概念 2、 裝箱是將實值型別轉換為參考型別 ;拆箱是將參考型別轉換為實值型別 利用裝箱和拆箱功能,可通過允許實值型別的任何值與Object 類型的值相互轉換,將實值型別與參考型別連結起來 例如: int val = 100; object obj = val; Console.WriteLine (“對象的值 = {0}", obj); 這是一個裝箱的過程,是將實值型別轉換為參考型別的過程 int val = 100; object
Time of Update: 2018-12-06
/*從資料庫提取資料*/string strconn="packet size=4096;user id=sa;data source=localhost;persist security info=True;initial catalog=Database;password=sa"; SqlConnection sqlconn=new SqlConnection(strconn); sqlconn.Open(); SqlDataAdapter
Time of Update: 2018-12-06
今天,師兄談及了公司招聘時候考的C++題,聽了之後有一種醍醐灌頂的感覺,原來C++這麼深不可測,真的需要看一下Effective C++。當然就聽到的感受分享一下….1.首先是交換二個資料,我們平時都用了第三個變數,最多也就知道不用第三個變數交換實數的方法,勉強就是什麼加法吧~~~可是,師兄說,不能用哪種方法,myGod,難道還有第三種方法,哎~~~要是我去面試,定死定了。那麼是什麼方法呢,即用異或即可,高效,而且還可以處理任何資料類型。如下:view plaincopy to
Time of Update: 2018-12-06
所謂泛型是指將型別參數化以達到代碼複用提高軟體開發工作效率的一種資料類型。一種類型預留位置,或稱之為型別參數。我們知道一個方法中,一個變數的值可以作為參數,但其實這個變數的類型本身也可以作為參數。泛型允許我們在調用的時候再指定這個型別參數是什麼。在.net中,泛型能夠給我們帶來的兩個明顯好處是——型別安全和減少裝箱、拆箱。 例如:通常一個方法或過程的簽名都是有明確的資料類型的。 如 : public void ProcessData(int i){} public void
Time of Update: 2018-12-06
QQ2009版和2010版都有表單抖動的功能其實這個功能在C#中也可以實現。改變表單的位置,間隔一定時間,但必須是圍繞起始位置改變表單位置,否則就只是表單的移動。 代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
Rectangle rectangle = e.ClipRectangle;BufferedGraphicsContext GraphicsContext = BufferedGraphicsManager.Current;BufferedGraphics myBuffer = GraphicsContext.Allocate(e.Graphics, e.ClipRectangle); Graphics g = myBuffer.Graphics;g.PixelOffsetMode =
Time of Update: 2018-12-06
轉自:《模式——工程化實現及擴充》(設計模式C# 版) http://www.cnblogs.com/callwangxiang/ http://www.cnblogs.com/callwangxiang/archive/2011/05/23/ExerciseAABridge.html的參考答案 1、分析依賴關係要點: 1)IA、IB、IC、ID平級正交關係 2) IE是IA的下級抽象關係 3)IF和IG是IC的下級抽象關係,而且IC與IG為1:N的關係,
Time of Update: 2018-12-06
轉自:《模式——工程化實現及擴充》(設計模式C# 版)http://www.cnblogs.com/callwangxiang/ 由你負責開發一個產生表格的程式,表格的格式定義如下:<table> <name>表格名稱</name> <head> <col>名稱</col> <col>名稱</col> ...... </head>
Time of Update: 2018-12-06
using System;using System.Windows;using System.Speech.Recognition;namespace Speech_Recognition{ public partial class Window1 : System.Windows.Window { public Window1() { InitializeComponent();