Time of Update: 2016-05-10
標籤: OpenFileDialog open = new OpenFileDialog();//建立對話方塊 open.InitialDirectory = @"C:\Documents and Settings\All Users\案頭"; //設定對話方塊路徑 open.Title = "對話方塊1"; //對話方塊標題 open.Filter = "文字文件|*.txt|所有檔案|*.*";
Time of Update: 2016-05-09
標籤:lock 的目的很明確:就是不想讓別人使用這段代碼,體現在多線程情況下,只允許當前線程執行該代碼地區,其他線程等待直到該線程執行結束;這樣可以多線程避免同時使用某一方法造成資料混亂。一般定義如下:private static readonly object obj = new object();lock(obj){‘‘‘代碼塊} MSDN給出:我們lock的一般是對象,不是數值和字串。 1、為什麼不能lock實值型別 比如lock(
Time of Update: 2016-05-09
標籤: 從序言中,大家應該對委託和事件的重要性有點瞭解了吧,雖然說我們現在還是能模糊,但是從我的大白話系列中,我會把這些概念說的通俗易懂的。首先,我們還是先說說委託吧,從字面上理解,只要是中國人應該都知道這個意思,除非委託2個中文字不認識,舉個例子,小明委託小張去買車票。
Time of Update: 2016-05-09
標籤: 一.using釋放資源 using不可以釋放所有的對象,原因如下: 1.using可以主動釋放的對象都需要實現IDisable介面。 2.即使都實現了IDisable介面,也沒有必要全部使用using,我們只對那些對系統效能有重要 影響的對象進行了using限定,而其他的對象可以交給記憶體回收行程處理。using釋放資源的過程: 首先回顧資料庫連接和關閉代碼的寫法,說明資料庫連接是一種寶貴的資源,用
Time of Update: 2016-05-09
標籤:Visual Studio 2010 本主題介紹在序列化 XML 樹時如何控制命名空間首碼。在很多情況下,不需要控制命名空間首碼。但是,某些 XML 編程工具需要命名空間首碼的特定控制。 例如,您可能正在操作 XSLT 樣式表或 XAML 文檔,其中包含引用特定命名空間首碼的嵌入式 XPath 運算式,在這種情況下,一定要使用這些特定首碼對文檔進行序列化。這是控制命名空間首碼的最常見的原因。需要控制命名空間首碼的另一個常見原因是:您希望使用者手動編輯 XML
Time of Update: 2016-05-09
標籤:使用static來定義變數和到期時間 //===================== 初始化待用資料 ========================== #region private static DateTime TokenExpTime = DateTime.Now.AddDays(-5); //Access_Token到期時間 private static string Access_Token = "";
Time of Update: 2016-05-09
標籤:摘要: (主要是傳智播客的趙劍宇老師上課的筆記自己在加上一點自己的理解,在此感謝趙劍宇老師)1、變數類型int double string char bool decimal變數的使用規則:先聲明再賦值最後使用1 int number;2 number=10;3 number=20;4 Console.WriteLine(number);2、Camel
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ClassTrining 7 { 8 class 基類與衍生類別 9 {10 }11 12 /// <summary>13 /// 基類BaseClass14 /// </summary>15
Time of Update: 2016-05-08
標籤:RabbitMQ是一個訊息代理,基本思路很簡單:接收和推送訊息。你可以把它當做是郵局,當你把信件放進郵箱裡時,你可以非常的確信郵遞員一定會把信件交給收件人。RabbitMQ就是一個郵箱,郵局以及快遞員。RabbitMQ就是一個郵箱,郵局以及快遞員。和郵局的不同的是,RabbitMQ處理的不是信紙,而是接收,儲存,轉寄二進位的訊息資料。 以下是RabbitMQ中的一些術語:生產(Producing)就是發送。發送訊息的程式就是生產者(Producer)。生產者用“P&r
Time of Update: 2016-05-08
標籤:索引程式碼範例: 索引的使用樣本:
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ClassTrining 7 { 8 class Program 9 { 10 static void Main(string[] args) 11 { 12 } 13 } 14
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using ClassTrining; 6 namespace TrinTwo 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 //跨程式集調用類1
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ClassTrining 7 { 8 class 事件測試 9 {10 public void 測試()11 {12 //產生10以內的隨機數13 var 隨機數 = new
Time of Update: 2016-05-08
標籤:C# 項目提交過程中感受新到一家互連網公司,昨天第一次提交代碼,遇到了不少問題,而且大多數是代碼格式問題,特此將範的錯誤記錄下來,自我警示。1. 代碼對齊,這個雖然一直也都在注意,不過還是有一行代碼沒有對齊,以後注意吧,提交前一定要先檢查一下。2. 多餘的空格,在代碼編寫的過程中,會不經意間,多敲幾下Space鍵,用VS的時候也看不出來,但是一旦提交到SVN上面,就會顯示紅色。3. 之前的公司喜歡將一些暫時用不到的代碼注釋掉,但是目前的boss,喜歡清清爽爽,注釋掉的代碼全部清除。4.
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ClassTrining 7 { 8 class 員工 9 {10 /// <summary>11 /// 姓名12 /// </summary>13 public
Time of Update: 2016-05-08
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ClassTrining 7 { 8 class 事件 9 {10 class Demo11 {12 /// <summary>13 ///
Time of Update: 2016-05-09
標籤:時間:2016-05-09 21:28:03 星期一題目編號:[2016-05-09][51nod][1046 A^B Mod C]題目大意:給出3個正整數A B C,求A^B Mod C。分析:直接快速冪#include<stdio.h>using namespace std;typedef long long ll;ll pow_mod(ll a,ll p,ll mod){ ll ans = 1; while(p > 0){
Time of Update: 2016-05-09
標籤:4-7 統計某類完全平方數 (20分)本題要求實現一個函數,判斷任一給定整數N是否滿足條件:它是完全平方數,又至少有兩位元字相同,如144、676等。函數介面定義:int IsTheNumber ( const int N );其中N是使用者傳入的參數。如果N滿足條件,則該函數必須返回1,否則返回0。裁判測試程式範例:#include <stdio.h>#include <math.h>int IsTheNumber (
Time of Update: 2016-05-09
標籤:Problem Description 給你2個分數,求他們的和,並要求和為最簡形式。Input 輸入首先包含一個正整數T(T<=1000),表示有T組測試資料,然後是T行資料,每行包含四個正整數a,b,c,d(0import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc= new Scanner(System.in);
Time of Update: 2016-05-08
標籤:c