随笔分类 - 技术目录十[C#]
摘要:sql += "and t1.CarNum like '%@CarNum%' "; //错误的写法 sql += "and t1.CarNum like '%'+@CarNum+'%' ";//正确的写法
阅读全文
摘要:return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Su
阅读全文
摘要:public class CultureeeResolver : IValueResolver<ILocalizableDbEntity, ILocalizableModel, string> { public string Resolve(ILocalizableDbEntity source,
阅读全文
摘要:其次,(int) 和 Convert.ToInt32 是两个不同的概念,前者是类型转换,而后者则是内容转换,它们并不总是等效的。我们很清楚 C# 提供类型检查,你不能把一个 string 强制转换成 int,隐式转换就更加不可能,例如如下的代码就行不通了: string text = "1412";
阅读全文
摘要:转载:System.InvalidOperationException: Collection was modified; enumeration operation may not execute._刘宁的专栏-CSDN博客 今天在查看系统的Log的时候发现下面的异常抛出: System.Inva
阅读全文
摘要:LINQ中的Include()有什么作用? 我尝试进行了大量研究,但我更像是数据库专家-因此,即使MSDN中的解释对我也没有任何意义.有人可以解释一下,并提供一些示例说明SQL查询中的Include()语句吗? 解决方案 例如,假设您要获取所有客户的列表: var customers = conte
阅读全文
摘要:转载自:FormsAuthenticationTicket用法 - 寂寞的蚂蚁 - 博客园 (cnblogs.com) FormsAuthenticationTicket :提供对使用 forms 身份验证用于确定用户身份的票证的属性和值的访问。 此类不能被继承。 其构造函数有三个: FormsAu
阅读全文
摘要:有的实体类并没有Serializable这个标记也是可以序列化的。网上有人说这个可以用来规定可序列化的范围。如下: [Serializable] public class MyObject { public int n1; [NonSerialized] public int n2; public
阅读全文
摘要:public static IEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector) { if (
阅读全文
摘要:public static TSource Single<TSource>(this IEnumerable<TSource> source) { if (source == null) throw Error.ArgumentNull("source"); IList<TSource> list
阅读全文
摘要:namespace System.Net { // Summary: // Contains the values of status codes defined for HTTP. public enum HttpStatusCode { // Summary: // Equivalent to
阅读全文
摘要:转载与:线程池之ThreadPool类与辅助线程 - <第二篇> - 逆心 - 博客园 (cnblogs.com) 一、CLR线程池 管理线程开销最好的方式: 尽量少的创建线程并且能将线程反复利用(线程池初始化时没有线程,有程序请求线程则创建线程); 最好不要销毁而是挂起线程达到避免性能损失(线程池
阅读全文
摘要:目前项目存在页面展示大量图片,效率不高,考虑优化性能,改为ashx+异步下载的方式,废话不说直接贴code: using System; using System.Web; using System.IO; using System.Web.SessionState; using System.Th
阅读全文
摘要:delegate void MyDelegate(); class Program { static void Main(string[] args) { MyDelegate myDelegate = new MyDelegate(Show); myDelegate.Invoke();//延迟3秒
阅读全文
摘要:[System.Security.SecurityCritical] // auto-generated_required [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark
阅读全文
摘要:/* ** Returns true if the thread is a threadpool thread. */ public extern bool IsThreadPoolThread { [System.Security.SecuritySafeCritical] // auto-gen
阅读全文
摘要:public bool IsBackground { [System.Security.SecuritySafeCritical] // auto-generated get { return IsBackgroundNative(); } [System.Security.SecuritySafe
阅读全文
摘要:[Obsolete("The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)] public
阅读全文
摘要:// As the culture can be customized object then we cannot hold any // reference to it before we check if it is safe because the app domain // owning t
阅读全文
摘要:public static Context CurrentContext { [System.Security.SecurityCritical] // auto-generated_required get { return CurrentThread.GetCurrentContextInter
阅读全文