随笔分类 - C#
对数据的增删查改深度理解三(多)层编程理念
摘要:比较容易遗忘的代码:UI层: private void btnSelect_Click(object sender, EventArgs e) { if (txtIDCar.Text.Trim().Length == 18) { DeliverData deliver = new DeliverData(); TblPerson person = null; if ((person = deliver.Select(txtIDCar....
阅读全文
用用户登录简单理解三层思想
摘要:项目文件列表:GetUserLoginState.sc public class GetUserLoginState { /// /// 检测用户登录状态 /// public GetUserLoginState() { } //推荐在此定义类型变量,而不是在方法中new一个新的对象 private TLoginModel model; public UserLoginStateEnum LoginState(string userName, strin...
阅读全文
用简单的修改数据理解三层概念
摘要:项目文件列表:文件中值得注意的代码:DataManager.cs: public List GetDataList() { List models; SqlHelper sqlhelper = new SqlHelper(); string sql = "select * from MyOrders"; using (SqlDataReader reader = sqlhelper.ExecuteReader(sql, null)) { ...
阅读全文
单表数据加载到TreeView(.Node.Level>=2) "蝴蝶效应" SelectedNode注意事项 效能优化 综合问题
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Configuration;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace 将单表数据加载到TreeView{ public pa...
阅读全文
NPOI 操作数据库中数据的导入导出(Excel.xls文件) 和null数据的处理。
摘要:App.config: *.scusing NPOI.HSSF.UserModel;using NPOI.SS.UserModel;//using NPOI.HSSF.UserModel;using System;using System.Collections.Generic;using System.ComponentModel;using System.Configuration;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.I...
阅读全文
深拷贝浅拷贝[对象序列化]
摘要:using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Runtime.Serialization.Formatters.Binary;using System.Text;using System.Threading.Tasks;namespace 深拷贝浅拷贝_对象序列化_{ class Program { static void Main(string[] args) { #region 深浅拷贝原理...
阅读全文
泛型<T>,是你肿莫了,还是我错了...
摘要:委托自定义数组排序 项目一共三个文件如下。CSort.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 委托自定义数组排序{ class CSort { public CSort() { } /// /// /// /// internal void Show(T[] a...
阅读全文
飞行棋(士) [窗口 控制台 自定义 版] 附源码
摘要:下载地址 :http://pan.baidu.com/s/1pJ0Nlwf http://pan.baidu.com/s/1hqgII1m效果 :哈哈,里面 Bug 和可优化的代码 不少 ...
阅读全文
ip修改器
摘要:哈哈,算法来源于网络。。。源码:http://pan.baidu.com/s/11P0P9参考:http://bbs.csdn.net/topics/370201571 http://bbs.csdn.net/topics/380175680?page=1http://blog.csdn.net/tsinfeng/article/details/5879074截图
阅读全文
C# wpf 实现 MD5加密解密 小工具
摘要:源文件: http://pan.baidu.com/share/link?shareid=2038099474&uk=3912660076 MD5 C# 实现代码来源于网络,感谢原系作者!参考资料:http://groups.csail.mit.edu/cis/md6/index.html http://www.blogjava.net/songfei/articles/17601.html http://md5.mmkey.com/HTML/ABOUT.HTM http://md5.mmkey.com/HTML/C_.HTM http://md5.mmkey...
阅读全文
解决wpf项目中无法添加OpenFileDialog 实例的问题
摘要:直接添加引用:using Microsoft.Win32;或者放置鼠标于OpenFileDialogOpenFileDialog ofd = new OpenFileDialog();操作点击
阅读全文
遍历form中的所有空间并找到选中的radiobutton
摘要:源文件: http://pan.baidu.com/share/link?shareid=1481950339&uk=3912660076参考:http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspxusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u
阅读全文
计时器
摘要:源文件: http://pan.baidu.com/share/link?shareid=3199918884&uk=3912660076System.Threading.Timer is a simple, lightweight timer that uses callback methods and is served by thread pool threads. It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface t
阅读全文
同一WpfApplication下简单的页面转换
摘要:别人写的很不错的Dome...分享学习下源文件地址 : http://pan.baidu.com/share/link?shareid=1698564707&uk=3912660076
阅读全文
有关double数值应该注意的细节
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Form{ class Program { static void Main(string[] args) { Console.WriteLine("{0,4} :-> {1}", Convert.ToInt32(1.048), 1.048.ToString().Length);//1 :-> 5 Console.WriteLin...
阅读全文
八种方法计算字符串中特定字符的数量
摘要:从网络上总结的,便于以后的学习(*^__^*) 嘻嘻……源文件:http://pan.baidu.com/share/link?shareid=432792&uk=3912660076using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Text.RegularExpressions;namespace 求字符串中某个字符的数量{ /// /// 对于每个方法加个判断 /// str.IndexOf(char arg)>0 ? ///...
阅读全文
数组问题
摘要:数组:一组包含相同类型的变量值。(这里以int类型为例)源文件http://pan.baidu.com/share/link?shareid=426222&uk=3912660076一维数组: 声明,创建, 初始化和输出。 //一维数组 //1.声明一个 int[] array1 = new int[8]; foreach (int item in array1) { Console.Write(" " + item); } ...
阅读全文
C#解决字符串中空格的八大方法.
摘要:今天编写小程序时,被字符串中出现的空格卡住了,”一怒之下“就搜罗了网络上的多种解决字符串中的空格的方法。呵呵,分享一下...实际上没有八种方法的,只是一个喜欢的标题,呵呵,你懂得....源文件http://pan.baidu.com/share/link?shareid=426222&uk=3912660076using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 去除空格{ class Program { static void Main(...
阅读全文
C# 创建Public无参构造函数的快捷键
摘要:ctor(Constructor) + Tab 2 次 :Public无参构造函数"~" + Tab1 次 :析构函数,嘻嘻,实际~键,tab键,shift键都在一条线上,打出析构函数后把“~”变成想要的修饰词(public,private,...)加个space,一样的...个人的习惯而已...
阅读全文
C# 代码展开和折叠的快捷键
摘要:Ctrl+M + 光标所在块: 单击M折叠/双击M展开Ctrl+M+O:折叠所有块Ctrl+M+L:展开所有块还可以用 #region //code #endregion进行代码区域性管理。
阅读全文