随笔分类 -  C#笔记

1 2 下一页
C# unicode GBK UTF-8和汉字互转
摘要:界面:源码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.... 阅读全文
posted @ 2015-09-25 12:53 神秘藏宝室 阅读(5185) 评论(0) 推荐(0)
C# 汉字编码GB2312转换
摘要:功能界面源码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System... 阅读全文
posted @ 2015-09-25 11:52 神秘藏宝室 阅读(4379) 评论(0) 推荐(0)
C# 串口调试助手源码
摘要:本方法,禁用跨进程错误(做法不太好,但是对于单片机出身的人来说,好理解,能用就行)。基本功能:1.点串口号的下拉菜单自动当前检索设备管理器的COM2.发送模式可选,hex和string两种3.接收显示模式,hex和string两种4.发送多行数据5.发送单行,可增加自动换行(方便用于一些串口指令,很... 阅读全文
posted @ 2015-09-24 20:34 神秘藏宝室 阅读(11002) 评论(0) 推荐(1)
C# 中 textBox 侧面滑条 属性
摘要:ScrollBars 设置 Vertical 阅读全文
posted @ 2015-09-22 13:02 神秘藏宝室 阅读(667) 评论(0) 推荐(0)
C# 中 comboBox 禁止输入
摘要:属性DropDownStyle 设置为 DropDownList 阅读全文
posted @ 2015-09-21 21:12 神秘藏宝室 阅读(5846) 评论(0) 推荐(0)
制作透明的图标ICO
摘要:1.使用crowldraw画图保存为PNG格式,选择“被遮盖区域”,然后保存(保存为PNG的透明格式)。 2.使用IconWorkshop把透明的PNG格式导出为ICO。 阅读全文
posted @ 2013-11-30 15:23 神秘藏宝室 阅读(606) 评论(0) 推荐(0)
C#读取excel 找不到可安装的ISAM
摘要:实在没有办法了 就仔细的查看了 一下数据链接字符串: string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Dir + "\\"+fileName + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;"; 有对照了http://www.connectionstr... 阅读全文
posted @ 2013-11-20 11:21 神秘藏宝室 阅读(3682) 评论(1) 推荐(0)
C#BackgroundWorker组件
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threadin... 阅读全文
posted @ 2013-11-18 16:15 神秘藏宝室 阅读(509) 评论(0) 推荐(0)
C#线程池ThreadPool
摘要:线程池可以减少频繁的线程创建和销毁对系统性能的影响。ThreadPool默认是后台属性,IsBackground是true。线程池通过线程命名空间的ThreedPool类来实现,要请求由线程池中的一个线程来处理你的任务,需要调用QueueUserWorkItem方法。要注意,当你向线程池提交一个人物请求后,你就无法再取消它了。另外,线程池中每个线程按照默认的优先级进行。向线程池提交任务使用WaitCallback委托。线程池会对这个任务自动调用一个线程来处理。public delegate void WaitCallback(object state);using System;using S 阅读全文
posted @ 2013-11-18 15:20 神秘藏宝室 阅读(604) 评论(0) 推荐(0)
C#线程通信与异步委托
摘要:线程的通知机制AutoResetEvent是线程实现通知操作的重要方法。通常,AutoResetEvent用于通知正在等待线程已发生事件,允许线程通过发信号互相通信。AutoResetEvent时间对象提供了给我们可以控制线程执行的先后顺序,他的常用方法:Set设置并发送信号Reset重置信号,也就是使信号无效WaitOne等待一个信号WaitAny静态方法,等待一个信号数组,信号数组里面有任何信号都可以,否则等待WaitAll静态方法,等待一个i额信号数组,信号数组里面的信号全部到齐才可以,否则等待创建一个AutoResetEvent对象,构造方法里面需要带一个bool类型的参数,AutoR 阅读全文
posted @ 2013-11-18 14:54 神秘藏宝室 阅读(433) 评论(0) 推荐(0)
C#线程使用学习
摘要:线程的入口函数可以不带输入参数,也可以带输入参数: form1.cs using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using Syste... 阅读全文
posted @ 2013-11-18 12:32 神秘藏宝室 阅读(545) 评论(0) 推荐(0)
C# 线程
摘要:线程的方法和状态 Thread类常用方法: Start();启动线程 Sleep(int);静态方法,暂停当前线程指定ms数 Abort();通常使用该方法来终止一个线程 Suspend();该方法并不终止未完成的线程,它仅仅挂起线程,以后可以恢复 Resume();恢复被Suspend()方法挂起的线程执行 新建线程 using System;using System.Co... 阅读全文
posted @ 2013-11-18 11:14 神秘藏宝室 阅读(537) 评论(0) 推荐(1)
C# Lambda表达式与Linq
摘要:int[] arry = { 1, 3, 565, 76, 4, 32, 2 }; //linq写法 var res = from i in arry select i; //lambda写法 var res = arry.Select(i => i); //Linq... 阅读全文
posted @ 2013-11-17 13:01 神秘藏宝室 阅读(398) 评论(0) 推荐(0)
C#聚合运算方法
摘要:Aggregate 对集合值执行自定义聚合运算 Average 计算集合平均值 Count 对集合的元素惊醒计数,还可以仅对满足某一谓词函数的元素进行计数 LongCount 对大型集合中的元素进行计数,还可以仅对满足某一谓词函数的元素进行计数。 Max 确定集合中的最大值 Min 确定集合中的最小值 Sum 计算集合中值的总和。 阅读全文
posted @ 2013-11-17 12:34 神秘藏宝室 阅读(752) 评论(0) 推荐(0)
C# LINQ语法
摘要:from子句嵌套private void button5_Click(object sender, EventArgs e) { listBox1.Items.Clear(); List students = new List { new Student1{Name = "张三",Scores = new List{93,74,94,58}}, new Student1{Name = "李四",Scores = new List{94,74,86,58}}... 阅读全文
posted @ 2013-11-17 11:45 神秘藏宝室 阅读(332) 评论(0) 推荐(0)
C# Linq
摘要:LINQ- Language Integrated Query 语言集成查询LINQ通过对象的方式对数据库进行描述。LINQ是一种能够快速对大部分数据源进行访问和数据整合的一种技术,使用相同的基本查询表达式模式类查询和转换SQL数据库、ADO.NET数据集、XML文档和流已经.NET集合中的数据。从.NET3.5开始引入LINQLINQ to ObjectsLINQ to DataSetLINQ to SQLLINQ to EntitiesLINQ to XML命名空间System.Data.Linq 该命名空间包含支持与LINQ to SQL应用程序中的关系数据库进行交互的类System.D 阅读全文
posted @ 2013-11-16 15:47 神秘藏宝室 阅读(469) 评论(0) 推荐(0)
C# DataTable和DataRelation
摘要:form2.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace DataAdapter{ public partial class Form2 : Form { private DataSet ds = new DataSet(); p... 阅读全文
posted @ 2013-11-14 14:18 神秘藏宝室 阅读(2648) 评论(0) 推荐(0)
C#DataSet/DataAdapter
摘要:DataReader必须持续连接,所以在调用方法SqlDataReader作为返回类型时候,必须在方法外关闭流,很不方便。DataAdapter用于对数据源检索数据并填充到DataSet中的表。DataAdapter还可以将DataSet所做的更改进行解析回数据源。(通俗点,DataSet就是一个缓冲区,可以修改好数据,让DataAdapter返回回数据源)DataAdapter使用例程using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System. 阅读全文
posted @ 2013-11-14 12:06 神秘藏宝室 阅读(731) 评论(0) 推荐(0)
C#练习DataReader
摘要:SQL代码:create database ThreeDbgoUSE ThreeDb;GOCREATE TABLE classify --分类表( id int primary key identity(1,1), name nvarchar(20) not null)GOCREATE TABLE product --产品表( id int primary key identity(1,1), name nvarchar(20) not null, price decimal, number int default 0, c_id int FOR... 阅读全文
posted @ 2013-11-14 11:04 神秘藏宝室 阅读(1217) 评论(0) 推荐(0)
C#使用SQL语句时候的万用密码问题
摘要:实际上万用密码就是因为SQL里面的语句--是注释,利用bug添加用户名和密码。例如,用户名为 adada’ or 1=1--第一个种写法登录成功了第二种写法登录失败(正确)第三种写法登录失败(正确)测试代码数据库部分create database ThreeDbgoUSE ThreeDb;GOCREATE TABLE classify --分类表( id int primary key identity(1,1), name nvarchar(20) not null)GOCREATE TABLE product --产品表( id int primary key id... 阅读全文
posted @ 2013-11-12 18:25 神秘藏宝室 阅读(717) 评论(0) 推荐(0)

1 2 下一页

 >>>转载请注明出处<<<