Time of Update: 2018-12-07
書上看到的一個例子,放在這裡消化一下。如下的一段程式: 期待的運行結果是:第一個64400, 第二個1932。結果運行結果是: 解析:錯誤1:Short的最大長度是32767, 把64400賦給它,當然會報錯了。所以輸出了不可預知的數字。現在改一下程式:運行結果如下:第一個結果對了。第二個應該是1932,怎麼少了1塊五? 錯誤2:QuarterSold是long int, 150也是int,所以結果會被認為是int,也就是沒有小數點。64400除以150等於429.333,結果.333被抹掉了,
Time of Update: 2018-12-07
1 private void CreateXMLFile(string pathAndFileName) 2 { 3 XmlDocument doc = new XmlDocument(); 4 XmlElement rootElementUser,subElementUserID,subElementXMID; 5 6 XmlNode node =
Time of Update: 2018-12-07
下面的代碼實現修改顯示器解析度和重新整理頻率的功能:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Runtime.InteropServices;namespace ScreenResolution{ public class Form1 :
Time of Update: 2018-12-07
字串數組:using System;class MyClass{ static void Main() { string[] arr = new string[3] { "aa", "bb", "cc" }; foreach (string s in arr) Console.WriteLine(s); // aa/bb/cc Console.ReadKey(); }}整數數組:using System;class MyClass{
Time of Update: 2018-12-07
無參、無傳回值的函數:using System;class MyClass{ static void Show() { Console.WriteLine("function"); } static void Main() { Show(); //function Console.ReadKey(); }}參數:using System;class MyClass{ static void
Time of Update: 2018-12-07
之前一直想學學外掛程式編程, 主要的原因是感到現在的客戶需求變化不定 ,如果把全部功能整合在一個執行檔案中的話,修改,升級起來很不方便, 所以想採用外掛程式編程的方式, 只需要構建好了程式架構之後, 每完成一個功能,就可以讓使用者審核一個, 化整為零,讓Team Dev和客戶都能構掌握項目開發的進度. 同時大家通過這種方式,增強對項目按時完成的信心. 以下資料主要是從haha blog中獲得的, 從網上找了很多類似的資料,只有這個我覺得是比較適合初學者 複製 儲存//1
Time of Update: 2018-12-07
代碼如下: /// <summary> /// 擷取系統記憶體大小 /// </summary> /// <returns>記憶體大小(單位M)</returns> private static int GetPhisicalMemory() { ManagementObjectSearcher searcher = new Manageme
Time of Update: 2018-12-07
C#-計算相對路徑 /**//// <summary> /// 計算相對路徑 /// 後者相對前者的路徑。 /// </summary> /// <param name="mainDir">主目錄</param> /// <param name="fullFilePath">檔案的絕對路徑</param> /// <returns&
Time of Update: 2018-12-07
有了一些MIS的開發經驗,也用笨方法實現了根據不同使用者、不同角色、不同許可權分配不同菜單的功能,但總覺得那還不是自己想要的。因為那時有進度約束著的,為了趕工而投機取巧了罷了。 實現方法是這樣的:
Time of Update: 2018-12-07
1 /**//// <summary>2 /// 得到要素類某欄位的唯一值3 /// </summary>4 /// <param name="pFeatureClass">要素類</param>5 /// <param name="strFld">指定要得到唯一值的欄位</param>6 ///
Time of Update: 2018-12-07
在AE開發過程,總是要將某些對象暫時儲存起來,像element,layer,map,symbol 等等. ArcEngine提供了序列化對象的方法來儲存這些資訊, 所有能序列化的對象都支援IPersistStream 介面(詳查幫組文檔) .此外IXMLStream 也是比較重要的介面.具體請查看協助文檔. 本文參考了wall 大牛的技術文檔,並受到啟發.相關地址:
Time of Update: 2018-12-07
在 C 語言中, char 類型永遠都是一個位元組, 雙位元組字元類型是 wchar_t;但它不是內建類型, 定義在 stddef.h.給 wchar_t 類型的字元或字元數組(也就是字串)賦值要冠以 L;格式化輸出(如 printf) wchar_t 類型的字串, 要用 %S(而非 %s) 標識.#include <stdio.h>#include <stddef.h>int main(void){ wchar_t wc = L'A'; wchar_t
Time of Update: 2018-12-07
擷取類型大小的變數最好不是 int 類型, 而是 size_t 類型;size_t 在 stdio.h、stddef.h 都有定義.1. 擷取已知類型的大小:#include <stdio.h>#include <stddef.h>int main(void){ char n = 2; size_t size; size = sizeof(char); printf("%*u: char\n", n,size); size = sizeof(
Time of Update: 2018-12-07
1. 關於數組的首地址:#include <stdio.h>int main(void){ char cs[2][3] = { {'A','B','C'}, {'D','E','F'} }; char *p1,*p2,*p3,*p4; p1 = p2 = p3 = p4 = NULL; /* 下面四個指標都是指向了同一個地址 */
Time of Update: 2018-12-07
整型 int 可添加 short 和 long:short int: 簡為 short;long int: 簡為 long;long long int: 簡為 long long它們都可以再添加 unsigned:unsigned int: 簡為 unsignedunsigned short int: 簡為 unsigned shortunsigned long int: 簡為 unsigned longunsigned long
Time of Update: 2018-12-07
非指標參數(也就是傳值參數)不會被修改原始值, const 對它是沒有意義的.const 只用於指標.1. 第一種用法: const 類型 *變數:這種用法將限制修改指標指向的值.#include <stdio.h>int fun(const int *p) { *p += 1; /* 只有去掉 const 這句才可以執行 */ return *p;}int main(void){ int num = 3; printf("%d\n", fun(&
Time of Update: 2018-12-07
\' \" \\ \0 \a \b \f \n \r \t \U \u \v \x本例:代碼:using System;class MyClass{ static void Main() { Console.WriteLine("\""); Console.WriteLine("\u0022"); Console.WriteLine(@"\u0022"); Console.WriteLine();
Time of Update: 2018-12-07
抽象類別不能直接執行個體化:using System;abstract class MyClass{ }class Program{ static void Main() { /* 抽象類別不能直接執行個體化, 下面這樣會出錯 */ MyClass obj = new MyClass(); Console.ReadKey(); }}但抽象類別可以通過子類執行個體化:using System;abstract class
Time of Update: 2018-12-07
函數名: stpcpy 功 能: 拷貝一個字串到另一個 用 法: char *stpcpy(char *destin, char *source); 程式例: #include <stdio.h> #include <string.h> int main(void) { char string[10]; char *str1 = "abcdefghi"; stpcpy(string, str1); printf("%s/n", string);
Time of Update: 2018-12-07
這幾天花了點時間也把《C#規範3.0版》過了一遍,還是瀏覽,現在時間對我來說挺重要,只能過過,所以犧牲了一些具體學習的內容,建議初學者詳細的看每句話,吃透C#的文法。 這個系列的電子書資源可以在我的CSDN下載頻道找到:http://download.csdn.net/source/1792062 。