There are helpful articles are about Shared memory data switching using C#, but they are written in Chinese: 1: 共享内存操作类(C#源码) 2: 使用共享内存在进程之间传送数据

How to convert latitude and longitude like below values to double values ? “25°36’55.57″”E”,”45°39’12.52″”N” The calculation should be: result = 25 + (36 / 60) + (55.57 / 3600) String hour = “25″;String minute = “36″;String second = “55.57″;Double result = (hour) + (minute) / 60 + (second) / 3600;And of course a switch to [Read More ...]

This sample code is for testing some data type border value using C union. Worked on Linux OS. #include #include int main(void) { union { unsigned long int lms; unsigned short shms[2]; unsigned char  bms [4]; } myms; myms.lms = 0; while (1) { printf(“long: %ld  short: %d  byte: %d\n”, myms.lms, myms.shms[0], myms.bms[0]); usleep(900); myms.lms++; [Read More ...]

You might have known the following example: Math.Round(3.44, 1); //Returns 3.4.Math.Round(3.45, 1); //Returns 3.4.Math.Round(3.46, 1); //Returns 3.5. (code sample from Microsft msdn site) So here you might find something is different. why 3.45 is 3.4 ? Yes, in C#, the Math.Round method normally (but not always, see more examples below) make all 0.5 and less down [Read More ...]

Maybe you need to check .NET Data Type Suffixes, or call it Numeric Literals. For example:  100L means long type, then what meaning of 100M ? The following is all data type suffixes which I have found: Type        Suffix    .NET Framework Type                  ——————————————long        L or l    System.Int64decimal     M or m    System.Decimaldouble      D or d    System.Doublefloat       [Read More ...]

The lock keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released. The lock keyword marks a statement block as a critical section by obtaining the [Read More ...]

In some cases such as Multiple languages dynamically switching and if you have a main TabControl with some sub tab pages will be dynamically added into it, you might find it is not easy if you want to change all these dynamic tab pages. Actually, if you have done Multiple languages dynamically switching mechanism in [Read More ...]

Here is a sample from codeproject : private void CreateDatabase(DatabaseParam DBParam) {     System.Data.SqlClient.SqlConnection tmpConn;     string sqlCreateDBQuery;     tmpConn = new SqlConnection();     tmpConn.ConnectionString = “SERVER = ” + DBParam.ServerName +                          “; DATABASE = master; User ID = sa; Pwd = sa”;     sqlCreateDBQuery = ” CREATE DATABASE ”                        + DBParam.DatabaseName                        [Read More ...]

Assume you have define an enum like :public enum LanguageCollection : int{    English = 0,    简体中文,    Español,    Tuurkish,    Français}Is it possible to populate all enum item to a dropdownlist control without hard code each enum name ? The answer is Yes. Here is sample code :this.menuCBLanguage.Items.Clear();for (int i = 0; i < Enum.GetNames(typeof(LanguageCollection)).Length; i++){     this.menuCBLanguage.Items.Add(Enum.GetName(typeof(LanguageCollection), [Read More ...]

© 2013 CodeEase.com Suffusion theme by Sayontan Sinha