1///<summary> 2/// 将Unicode编码转换为汉字字符串3///</summary> 4///<param name="str">Unicode编码字符串</param> 5///<returns>汉字字符串</returns> 6publicstaticstring ToGB2312(string str)7 {8 StringBuilder sb = new StringBuilder();9 MatchCollection mCollection2 = Regex.Matches(str, "([\\w]+)|(\\\\u([\\w]{4}))");
10if (mCollection2 != null && mCollection2.Count > 0)
11 ...
///<summary>/// 获取当前时间戳///</summary>///<param name="bflag"></param>///<returns></returns>publicstaticstring GetTimeStamp(){return GetTimeStamp(DateTime.Now);}///<summary>/// 获取指定时间戳///</summary>///<param name="date"></param>///<returns></returns>publicstaticstring GetTimeStamp(DateTime date){TimeSpan ts = date - new DateTime(1970, 1, 1, 0, 0, 0, 0);return Convert.ToInt64(ts.TotalSeco...
方案一:for循环方法等 效率过慢 数据量过大时容易卡死 不建议使用 方案二:取交集 var intersection = datalist.Intersect(ExelLsit.,new TarGetComparer()).ToList();//需要重写IEqualityComparer Equals /// </summary> //public class TarGetComparer : IEqualityComparer<arko_dim_update_id_trial> //{ // public bool Equals(arko_dim_update_id_trial x, arko_dim_update_id_trial y) ...
在VB.NET调用Web Service提供的服务技术qq交流群:JavaDream:251572072
下面是一篇文章比较详细,其实具体操作很简单,把Web Service服务地址,利用工具(VS2010),通过添加引用的形式,添加到项目中来就可以应用了.
大家如果这个地方不会操场的话,可以问问我QQ:1606841559
当Web Service已经处于对外提供服务状态,VB.NET就可以通过HTTP"调用"来使用这些服务了。当然前提是要了解Web Service对外提供服务所对应的URL,当了解到Web ...
方法的调用delegate int test1(int a);class Program{static int num = 10;static void Main(string[] args){test1 t = new test1(max);t(40);Console.WriteLine("max,{0}", num);Console.ReadLine();}public static int max(int a){num += a;return num;}}
类额实例化class weituo {public int num = 10;//非静态public int max(int a){num += a;return num;}}Main ()
{weituo wt = new weituo();test1 t1 = new test1(wt.max...
在C#的List集合操作中,有时候需要将List元素对象拷贝存放到对应的数组Array中,此时就可以使用到List集合的CopyTo方法来实现,CopyTo方法是List集合的扩展方法,共有3个重载方法签名,分别为void CopyTo(T[] array)、void CopyTo(T[] array, int arrayIndex)、void CopyTo(int index, T[] array, int arrayIndex, int count)等三种形式,此文重点介绍CopyTo的第一种方法签名形式void CopyTo(T[] array)。首先定义个用于测试的类Te...
一般在做爬虫或者CMS的时候经常需要提取 href链接或者是src地址。此时可以使用正则表达式轻松完成。Regex reg = new Regex(@"(?is)<a[^>]*?href=([‘""]?)(?<url>[^‘""\s>]+)\1[^>]*>(?<text>(?:(?!</?a\b).)*)</a>");
MatchCollection mc = reg.Matches(yourStr);
foreach (Match m in mc) { richTextBox2.Text += m.Groups["url"].Value + "\n";//得到href值 ...
前两天看见扩展属性,瞬间感觉微软需要学习的东西实在是太多了,博大精深,我还差得很远,以下的扩展方法就是一个很好的东西。现在我先建立一个modelpublicclass Student{publicstring Id { get; set; }publicstring Name { get; set; }}View Code在实际场景中,可能我们需要在这个model里需要写一些方法,一些查询等等,但是我们在设计时希望model里面只是声明属性,其它方法不放在model里面,那么怎么做到两者兼容呢,扩展方法可...
此文章不断补充1、判断该字符串是否存在于字符串数组中1string[] arr = {"aaa","bbb","aba","ccc" };
2string str = "vv";
3 Console.WriteLine(arr.Contains(str)); 2、将字符串中的标点符号替换成空格1string str = "fdasjklfsdalj;dfsafjksdjkgd,fsdajklfjksldaklj klkfdska;fwefew.45fsd4521fsa3";
2string strRegex = Regex.Replace(str, @"\p{P}", "");
3 Console.WriteLine(strRegex); 原文:http:...
原文:【原创】开源Math.NET基础数学类库使用(12)C#随机数扩展方法 本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html开源Math.NET基础数学类库使用总目录:http://www.cnblogs.com/asxinyu/p/4329737.html前言 真正意义上的随机数(或者随机事件)在某次产生过程中是按照实验过程中表现的分布概率随机产生的,其结果是不可预测的,是不可见的。而计算机中的随机函数是按照一定算法模拟...
//这是一个json字符串 string str="{\"id\":1,\"name\":\"张三\",\"time\":\"2018-05-02T09:02:32.1869172+08:00\",\"money\":23.4,\"str\":[\"a\",\"b\",\"c\"]}"; //转化为对象 User user =(User) Jayrock.Json.Conversion.JsonConvert.Import(typeof(User),str);//获得对象myClass的所有属性组成的集合 propertys 需要引用using System.Reflection; PropertyInfo[] p = user.GetType().GetProperties(); ...
方法1:将图片复制到指定文件夹,在数据库中存储图片路径,通过读取路径来显示图片。string str;privatevoid toolStripButton1_Click(object sender, EventArgs e){if (openFileDialog1.ShowDialog() == DialogResult.OK){str = openFileDialog1.FileName;pictureBox1.Image = Image.FromFile(str);}}//打开文件并在PictureBox中显示图片privatevoid toolStripButton2_Click(object sender, EventArgs e){string filename = DateTi...
c# 操作txt文件
# 操作txt文件
c#创建文本privateconststring FILE_NAME = "ErroLog.txt";publicstaticvoid WriteFile(string str)...{StreamWriter sr; if (File.Exists(FILE_NAME)) //如果文件存在,则创建File.AppendText对象 ...{sr = File.AppendText(FILE_NAME);}else//如果文件不存在,则创建File.CreateText对象 ...{sr = File.CreateText(FILE_NAME);}sr.WriteLine(str);sr.Close();}C...
如果在win8,win7情况下报错:未知错误(0x80005000)见http://blog.csdn.net/ts1030746080/article/details/8741399using System;
using System.Collections;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;namespace IISControlHelper
{///<summary>/// IIS 操作方法集合///http://blog.csdn.net/ts1030746080/artic...
题外话:别指望看第一遍书就能记住和掌握什么——请看第二遍、第三遍。本人女猿一枚,2年工作经验,喜欢钻研,喜欢创新,闲暇之余喜欢写写博客,深知自身能力薄弱,如表达错误、不当之处请园友们多多指出,互相交流。三种泛型委托:1.predicate:定义:public delegate bool Predicate<in T>(T obj);这种委托返回值必须为bool型,可传入一个T类型参数;2.Action:定义:public delegate void Action<T>(T obj1,T obj2,.......T ob...