随笔分类 - C#笔记
C#学习笔记记录,每天进步一点!
摘要://全局唯一的单例 public static Form2 FrmSingle=null; private Form2() { InitializeComponent(); } public static Form2 GetSingle() { if (FrmSingle == null) { Fr
阅读全文
摘要:PLC读取数据高低位交换,批量保存到list集合,方便调用。 private void button1_Click(object sender, EventArgs e) { label1.Text = null; ushort[] nums = new ushort[] { 12, 34, 56,
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Li
阅读全文
摘要:MSSQL数据库查询SQL语句拼接 string dbConStr = ConfigurationManager.ConnectionStrings["dbConStr"].ConnectionString; string sqlText = "SELECT * FROM UserInfo"; Li
阅读全文
摘要:C# winform只允许程序运行一个 ,修改主入口文件。 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Fo
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.
阅读全文
摘要:/// <summary> /// 递归方式 : 思路简单但效率比循环方式低,递归次数越多,性能越低 /// </summary> /// <param name="n"></param> /// <returns></returns> public static int Fn(int n) { i
阅读全文
摘要:根据窗体名称创建窗体; /// <summary> /// 手动根据窗体名称创建窗体; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(o
阅读全文
摘要:对当前运行程序,可用如下程序获取当前的命名空间、类名、方法名: 1. // 0为本身的方法;1为调用方法 GetFrame(1) 2.// 方法名GetFrame(1).GetMethod().Name; 3. // 类名 GetFrame(1).GetMethod().ReflectedType.
阅读全文
摘要:c#用户登陆方法数据库 /// <summary> /// 用户登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object se
阅读全文
摘要:C#读取数据库表字段名和值 string SqlText1 = "SELECT * FROM UserInfo"; SqlDataReader sReader = SqlHelper.ExecuteReader(SqlText1, SqlHelper.GetSqlConnection()); sRe
阅读全文
摘要:StreamReader和StreamWrite操作文件 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threa
阅读全文
摘要:Path类 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _
阅读全文
摘要:string str ="welcome to bejing , hello china,jiyou wuhan"; Dictionary<char, int> dict = new Dictionary<char, int>(); for (int i = 0; i < str.Length; i
阅读全文

浙公网安备 33010602011771号