Time of Update: 2018-12-05
在c#中除法預設不保留小數點,看看下面的結果decimal result = 100 / 1000; // result = 0;需要保留小數點,可以如下decimal result = 100m / 1000;m代表decimal.如果是變數要如何處理呢?這是需要用到Math.Round()int x= 120;int y= 100000;decimal result = (decimal)x / y; // (decimal)x/ y 表示把 x 轉換成decimal再做除法運算,int
Time of Update: 2018-12-05
DateTime.Now=2009-7-16 5:20:56//今天DateTime.Now.Date.ToString();"2009-7-16 0:00:00"//周起始日期 DateTime.Now.Date.AddDays(-(int)(DateTime.Now.DayOfWeek)+1).ToString();{2009-7-13 0:00:00}DateTime.Now.Date.AddDays(7-(int)(DateTime.Now.DayOfWeek)).ToString();
Time of Update: 2018-12-05
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.IO.Packaging;using System.Xml;namespace ReadDocx{ class Program { static void Main(string[] args) { string
Time of Update: 2018-12-05
Boolean createdNew; //返回是否賦予了使用線程的互斥體初始所屬權 System.Threading.Mutex instance = new System.Threading.Mutex(true, "MutexName", out createdNew); //同步基元變數 if (createdNew) //賦予了線程初始所屬權,也就是首次使用互斥體 {
Time of Update: 2018-12-05
DES加密應該是最基礎的密碼編譯演算法,為了搞清楚它在.NET
Time of Update: 2018-12-05
http://www.cnblogs.com/chenlhuaf/archive/2009/02/11/1388426.html GridViewColumn column = new GridViewColumn(); GridViewColumnHeader h = new GridViewColumnHeader(); h.Content = "??????"; h.Tag = "*******";
Time of Update: 2018-12-05
學習C++從入門到精度的的十本最經典書籍
Time of Update: 2018-12-05
C++之 -------何為同步,非同步何解,阻塞了呢?非阻塞呢?走訪各種大小論壇,糾集縱多風雲看法,貼於此處表我觀點,界內人士若點迷津,小弟定會銘記終生,願高手們不吝賜教,長江後浪帶著前浪,擁抱光明永遠燦爛. --------題記以例子說明我對此的理解: 假設我是老闆,你是員工,我手頭上有件事,做完這件事我要回家拿東西. 同步: 我吩咐你去做事情,同時我在一旁等待結果,直到你做完我才回家. 阻塞:
Time of Update: 2018-12-05
文章目錄 1. Using C Macros for the so-called Magic Number2. Using C Macros for Basic Functions3. C Macro to Comment Out Code4. Using C Macros to Compile for Target Architecture(s)5. Using a C Macro to Swap Two VariablesA Macro To Detect
Time of Update: 2018-12-05
Important:A solider understanding of basal concepts is critical to any .NET Framework developer’s long-term success.Turst me: having a solid grasp of these concepts will allow you to build efficient applications faster and easier. Any data types the
Time of Update: 2018-12-05
原文地址: http://ainux.blog.hexun.com/2815875_d.html現在加密技術很多,比如SHA,MD5(已經被破解了),小可想和大家討論一下在.NET架構中簡單應用SHA演算法加密使用者登入密碼的方法。這裡我採用的是SHA1(安全散列演算法),是將不定長的字串轉換成160位(20位元組)位元組流散列演算法。這裡講的加密一般分以下幾個步驟:密碼的建立:1)對使用者的原始密碼進行第一次雜湊,得到UnsaltedPassword:User password
Time of Update: 2018-12-05
1 Response.ClearContent(); 2 Response.ClearHeaders(); 3 Response.ContentType = contentType; 4 //Response.ContentEncoding = System.Text.Encoding.UTF8; 5 //Response.Charset = "utf-8"; 6 Response.AddHeader("Co
Time of Update: 2018-12-05
判斷Socket是否串連上,需要通過發包來確認: 1 // 檢查一個Socket是否可串連 2 private bool IsSocketConnected(Socket client) 3 { 4 bool blockingState = client.Blocking; 5 try 6 { 7 byte[] tmp = new byte[
Time of Update: 2018-12-05
1)下載SharpZipLib.dll,在http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx中有最新免費版本,“Assemblies for .NET 1.1, .NET 2.0, .NET CF 1.0, .NET CF 2.0: Download [297 KB] ”點擊Download可以下載,解壓后里邊有好多檔案夾,因為不同的版本,我用的FW2.0。2)引用SharpZipLib.dll,在項目中點擊項目右鍵-
Time of Update: 2018-12-05
C#的MVC尋找對應的控制器首先是尋找當前域的如果找不到就會尋找備用的..但是有些時候我們是不想他去尋找備用的控制器.這裡就涉及到了一個DataToken routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home",
Time of Update: 2018-12-05
一個類,有時候搞不清楚到底用成員變數還是屬性。 如: 成員變數 public string Name; 或者用屬性 private string name public string Name { get { return name; } set { name = value;
Time of Update: 2018-12-05
1.字串格式化:關於字串的格式化,在以後的開發過程當中會有很多地方應用的到,包括到了WEB開發也同樣會應用的到,所以可以記一些,不過不需要完全撐握,需要用時網上可以查一下,能記多少記多少吧: public static void Main() { Console.WriteLine("在寬度為的空間裡靠左對齊:{0,-10}", 99); Console.WriteLine("在寬度為的空間裡靠右對齊:{0,10}", 99);
Time of Update: 2018-12-05
一、檔案系統概述 電腦系統的重要作用之一是能快速處理大量資訊,因此資料的組織和存取成為一個極為重要的內容。檔案是資訊的一種組織形式,而檔案系統的的目標就是提高儲存空間的利用率,接受使用者的委託實施對檔案的操作。 檔案系統是作業系統的一個重要組成部分。檔案系統所要解決的問題包括:管理儲存設定,決定檔案的存放位置和方式,提供共用能力,保證檔案安全性,提供友好的使用者介面。通過檔案系統,使用者和應用程式能方便地進行資料存放區,而不必關心底層存放裝置的實現。
Time of Update: 2018-12-05
文章目錄 IntroductionPresumed Knowledge BaseThe RegularExpression AssemblyA Brief Overview of the NamespaceSimple MatchesReplacing StringsEngine DetailsProcedural-Based vs. Expression-BasedProcedural-Based PatternsExpression-Based
Time of Update: 2018-12-05
1、 Microsoft.Office.Interop.Word.Application wordApp = new ApplicationClass()word對象2、 Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing) 文檔對象3、 Object Nothing =