随笔分类 - 技术目录十[C#]
摘要:源码: public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value) { ICollection<TSource> collection = source as ICollection<TS
阅读全文
摘要:源码: public static IEnumerable<TSource> Concat<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second) { if (first == null) throw Error.
阅读全文
摘要:源码: public static IEnumerable<TResult> Cast<TResult>(this IEnumerable source) { IEnumerable<TResult> typedSource = source as IEnumerable<TResult>; if
阅读全文
摘要:public static float? Average(this IEnumerable<float?> source) { if (source == null) throw Error.ArgumentNull("source"); double sum = 0; long count = 0
阅读全文
摘要:官网上给的案例: // Custom class. class Clump<T> : List<T> { // Custom implementation of Where(). public IEnumerable<T> Where(Func<T, bool> predicate) { Conso
阅读全文
摘要:相关源码: public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) { if (source == null) throw Error.ArgumentNull(
阅读全文
摘要://TSource Aggregate<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, TSource> func); //求和 var list = Enumerable.Range(1, 100); var co
阅读全文
摘要:internal static string MapStringAttributeToString(string s) { // If it's an empty string, change it to null if (s != null && s.Length == 0) return nul
阅读全文
摘要:namespace System { [__DynamicallyInvokable, ComVisible(true)] [Serializable] public delegate void EventHandler(object sender, EventArgs e); }
阅读全文
摘要:string hwrdstr = string.Empty ; hwrdstr = string.Join("、",userEntityList.Select(x => x.Account));
阅读全文
摘要:要继承IRequiresSessionState
阅读全文
摘要:C#中 TrimEnd()用法 ①去除最后的逗号 string str=ab,cd,ef,; str=str.TrimEnd(new char[] { ',' }); 返回结果则是:ab,cd,ef ②去掉日期格式的00:00:00 char [] strRemove={'0',':'}; lblB
阅读全文
摘要:首先需要Ionic.Zip.dll 页面前台 <body> <form id="form1" runat="server"> <p> <asp:Button ID="PackDown" runat="server" Text="打包下载" OnClick="PackDown_Click" /></p
阅读全文
摘要:问题说明: 1 页面生成后,再次点击其中的button,执行函数中获取成员变量的值为空: 1 2 3 4 5 6 7 8 9 public partial class products : System.Web.UI.Page { private string bigCategory;//= "pr
阅读全文
摘要:这个问题就是:web页面是无状态的怎么使页面里面的变量赋值后,在页面刷新时仍然保持赋给的值利用ViewState来实现,例如: ViewState["AttemptNumber"] = 0; 转载于:https://www.cnblogs.com/burandanxin/archive/2007/1
阅读全文
摘要:public static string HMACSHA1(this string text, string secretKey) { HMACSHA1 hmacsha1 = new HMACSHA1(); hmacsha1.Key = Encoding.UTF8.GetBytes(secretKe
阅读全文
摘要:https://github.com/dotnet/corefx 这个是.net core的 开源项目地址 https://github.com/aspnet 这个下面是asp.net core 框架的地址,里面有很多仓库。 https://github.com/aspnet/EntityFrame
阅读全文
摘要:一个查询的语句只用了2秒,对比了一下,发现50s的那个语句使用的IEnumerable查询,而2s的那个语句用的是IQueryable查询,网上找了一下资料,找到了原因:IEnumerable与IQueryable查询机制的不同。IEnumerable与IQueryable查询机制的不同。 IEnu
阅读全文
摘要:在C#的数据表格DataTable的操作中,有时候因为业务需要,我们需要获取到DataTable所有列或者某一列的数据类型,此时我们可以通过DataTable中的Columns属性对象的DataType属性来获取,获取的DataType属性的返回值为Type类型的对象,获取到DataType属性后,
阅读全文
摘要:一、List<T>/IEnumerable转换到DataTable/DataView 方法一: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
阅读全文
浙公网安备 33010602011771号