StringExtensions】的更多相关文章

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Globalization; using System.IO; using System.Web; using System.Web.UI.WebControls; using System.ComponentModel; u…
public static string MakeSafeSql(this string s) { string t = s; t = t.Replace("'", "''"); t = t.Replace("[", "[[]"); t = t.Replace("%", "[%]"); t = t.Replace("_", "[_]"); retu…
一个技术汪的开源梦 —— 目录 想必大家在项目中都接触过 JSON 或者 XML 吧,为了将对象在网络上传输或者将其持久化必须将其序列化为一个字符串然后进行后续操作.常见的就是将其序列化成 JSON 或者 XML . 大家在项目中应该都看到过这样的工具类 例如 ***XmlHelper.***JsonHelper 等,没错这一些助手类会帮助我们重复造轮子.既然是组件并且还是是开源的必须考虑每个功能的后续可扩展性以及易用性. ISerializer 序列化者接口 using System; nam…
介绍了各种移动设备所使用的GPU,以及各个GPU所支持的压缩纹理的格式和使用方法.1. 移动GPU大全 目前移动市场的GPU主要有四大厂商系列:1)Imagination Technologies的PowerVR SGX系列 代表型号:PowerVR SGX 535.PowerVR SGX 540.PowerVR SGX 543MP.PowerVR SGX 554MP等 代表作  :Apple iPhone全系.iPad全系,三星I9000.P3100等2)Qualcomm(高通)的Adreno…
下面是代码: public virtual IHtmlString Meta() { AggregateHtmlString htmlStrings = new AggregateHtmlString(); var htmlMeta = this.PageContext.HtmlMeta; if (htmlMeta != null) { if (!string.IsNullOrEmpty(htmlMeta.Canonical)) { htmlStrings.Add(new HtmlString(…
首先我们找到这个类. 这个类有如下的方法: #region Title & meta [Obsolete("Use HtmlTitle")] public IHtmlString Title() { return HtmlTitle(); } /// <summary> /// HTMLs the title. /// </summary> /// <returns></returns> public virtual IHtmlS…
In C#, extension methods enable you to add methods to existing class without creating a new derived class. Extension methods 要求: Define a static class to contain extension method. This class must be visible to client code. Implement the extension met…
class Program { static void Main(string[] args) { Console.WriteLine("============================序列化单个对象为JSON格式======================================================"); var jsonObj = GetUser().ToJsonString(); Console.WriteLine(jsonObj + "\n…
前言 本文来聊一聊我们经常会做的空值检查问题,从一个简单的空值检查Any Where,到设计模式的NullObjectPattern,再到C#6.0“可能”会提供的语法,让我们体验一次语言开发上的“持续改进”,Let’s go~ 什么是空引用异常 作为一个敲过代码的码农来说,似乎没有谁没有遇到过NullReferenceException这个问题,有些时候当方法内部调用一个属性.方法(委托)时,我们控制这些属性在“外部”的表现(当然某些情况下使用ref关键字除外),所以我们要在方法的内部去判断属…
整理一下自己经常用到的几个扩展方法,在实际项目中确实好用,节省了不少的工作量. 1  匿名对象转化 在WinForm中,如果涉及较长时间的操作,我们一般会用一个BackgroundWorker来做封装长时间的操作,给它传递一个类型参数. var parm = new { UserId = txtUserId.Text, UserText = txtText.Text, TabIndex = tabControl.SelectedIndex, CheckUrl = urls, SupportFor…