.NET开发中经常用到的扩展方法
整理一下自己经常用到的几个扩展方法,在实际项目中确实好用,节省了不少的工作量。
1 匿名对象转化
在WinForm中,如果涉及较长时间的操作,我们一般会用一个BackgroundWorker来做封装长时间的操作,给它传递一个类型参数。
var parm = new { UserId = txtUserId.Text, UserText = txtText.Text, TabIndex = tabControl.SelectedIndex, CheckUrl = urls, 
SupportFormat = supportFormat, DeleteMHT = chkDelete.Checked, FileFormat=supportFileFormat };
backgroundWorker.RunWorkerAsync(parm);
注意到一点,我这里没有用一个类型,而是用一个匿名类型,以节省类型的定义。这种场景经常遇到,比如这个后台方法需要传三个参数,那个后台方法需要五个参数,如果不用我这个方法,那你需要额外的定义二个类型,分别包含三个参数或是五个参数。
再来看DoWork时,如何使用这个匿名方法
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
#region Download
backgroundWorker.ReportProgress(10, string.Format("Analyst beginning......"));
var parm = e.Argument.TolerantCast(new { UserId = string.Empty, UserText = string.Empty, TabIndex = 0,
CheckUrl = new List<string>(), SupportFormat = string.Empty, DeleteMHT = false, FileFormat=string.Empty});
与RunWorkerAsnyc中传递的参数一样,定义一个匿名类型,各属性放默认值,然后调用TolerantCast方法,即可得到前面传入的值。
这个方法很大的方便了这种使用情景:方法与方法之间需要传递不固定的参数,但是又不愿意重新定义一个新的类型。这个方法不来自于CodeProject,我把它的代码转在下面,供您参考
/// <summary>
/// 转换匿名类型
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="o"></param>
/// <param name="example"></param>
/// <returns></returns>
public static T TolerantCast<T>(this object o, T example)
where T : class
{
IComparer<string> comparer = StringComparer.CurrentCultureIgnoreCase;
//Get constructor with lowest number of parameters and its parameters
var constructor = typeof (T).GetConstructors(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
).OrderBy(c => c.GetParameters().Length).First();
var parameters = constructor.GetParameters(); //Get properties of input object
var sourceProperties = new List<PropertyInfo>(o.GetType().GetProperties()); if (parameters.Length > 0)
{
var values = new object[parameters.Length];
for (int i = 0; i < values.Length; i++)
{
Type t = parameters[i].ParameterType;
//See if the current parameter is found as a property in the input object
var source = sourceProperties.Find(delegate(PropertyInfo item)
{
return comparer.Compare(item.Name, parameters[i].Name) == 0;
}); //See if the property is found, is readable, and is not indexed
if (source != null && source.CanRead &&
source.GetIndexParameters().Length == 0)
{
//See if the types match.
if (source.PropertyType == t)
{
//Get the value from the property in the input object and save it for use
//in the constructor call.
values[i] = source.GetValue(o, null);
continue;
}
else
{
//See if the property value from the input object can be converted to
//the parameter type
try
{
values[i] = Convert.ChangeType(source.GetValue(o, null), t);
continue;
}
catch
{
//Impossible. Forget it then.
}
}
}
//If something went wrong (i.e. property not found, or property isn't
//converted/copied), get a default value.
values[i] = t.IsValueType ? Activator.CreateInstance(t) : null;
}
//Call the constructor with the collected values and return it.
return (T) constructor.Invoke(values);
}
//Call the constructor without parameters and return the it.
return (T) constructor.Invoke(null);
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
2 集合对象上的扩展方法
先看例子,下面的测试方法
var @enum = new[] {1, 2, 3, 4}.AsEnumerable();
var sum = 0;
@enum.ForEach(n => sum += n);
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
这个扩展方法,可以直接在一个集合上执行一个Lambda表达式,返回结果,相当于有二个参数的Fun<T,T>,来看它的源代码定义
public static void ForEach<T>(this IEnumerable<T> @enum, Action<T> mapFunction)
{
foreach (var item in @enum) mapFunction(item);
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
3 字符串类型上的扩展方法
这里可以做的扩展方法比较多,一个明显的例子就是,依据String类型写的Helper类型方法最多。
来看一个字符串拼凑的例子,平时我们用string.Format这样的写法,如果用下面的扩展方法,看起来更直观一些。
string s = "{0} ought to be enough for {1}.";
string param0 = "64K";
string param1 = "everybody";
string expected = "64K ought to be enough for everybody.";
Assert.AreEqual(expected, s.FormatWith(param0, param1),
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
这个扩展方法的定义也简单,只有一行代码
/// <summary>
/// Formats a string with two literal placeholders.
/// </summary>
/// <param name="text">The extension text</param>
/// <param name="arg0">Argument 0</param>
/// <param name="arg1">Argument 1</param>
/// <returns>The formatted string</returns>
public static string FormatWith(this string text, object arg0, object arg1)
{
return string.Format(text, arg0, arg1);
}
可以考虑把参数延长到任意个,改写这个扩展方法,也只需要一行代码皆可
/// <summary>
/// Formats a string with two literal placeholders.
/// </summary>
/// <param name="text">The extension text</param>
/// <param name="arg0">Argument 0</param>
/// <param name="arg1">Argument 1</param>
/// <returns>The formatted string</returns>
public static string FormatWith(this string text, params object[] args))
{
return string.Format(text, args);
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
另一个有用的扩展方法是字符串与枚举类型之间的转化,扩展方法定义如下
/// <summary>
/// Parses a string into an Enum
/// </summary>
/// <typeparam name="T">The type of the Enum</typeparam>
/// <param name="value">String value to parse</param>
/// <returns>The Enum corresponding to the stringExtensions</returns>
public static T ToEnum<T>(this string value)
{
return ToEnum<T>(value, false);
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
参考下面的例子,使用这个实用的扩展方法
enum ProductVersion
{
Standard,
Enteprise,
Ultimate
} [TestMethod]
public void StringToEnumTest()
{
Assert.AreEqual(ProductVersion.Standard, "Standard".ToEnum<ProductVersion>());
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
4 数字类型上的扩展方法
我这里有一个明显的例子是显示容量的扩展方法,请看下面的方法组:
/// <summary>
/// Kilobytes
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static int KB(this int value)
{
return value * 1024;
} /// <summary>
/// Megabytes
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static int MB(this int value)
{
return value.KB() * 1024;
} /// <summary>
/// Gigabytes
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static int GB(this int value)
{
return value.MB() * 1024;
} /// <summary>
/// Terabytes
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static long TB(this int value)
{
return (long)value.GB() * (long)1024;
}
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
用起来就很轻松了,简单的一行代码,获取容量的数字值
var kb = 1.KB();
var mb = 1.MB();
var gb = 1.GB();
var tb = 1.TB();
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
最后一组扩展方法在计算百分比中经常遇到,比如统计计算,任务完成百分比计算:
 #region PercentageOf calculations
        /// <summary>
        /// The numbers percentage
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>The result</returns>
        public static decimal PercentageOf(this int number, int percent)
        {
            return (decimal)(number * percent / 100);
        }
        /// <summary>
        /// Percentage of the number.
        /// </summary>
        /// <param name="percent">The percent</param>
        /// <param name="number">The Number</param>
        /// <returns>The result</returns>
        public static decimal PercentOf(this int position, int total)
        {
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)position / (decimal)total * 100;
            return result;
        }
        public static decimal PercentOf(this int? position, int total)
        {
            if (position == null) return 0;
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)((decimal)position / (decimal)total * 100);
            return result;
        }
        /// <summary>
        /// The numbers percentage
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>The result</returns>
        public static decimal PercentageOf(this int number, float percent)
        {
            return (decimal)(number * percent / 100);
        }
        /// <summary>
        /// Percentage of the number.
        /// </summary>
        /// <param name="percent">The percent</param>
        /// <param name="number">The Number</param>
        /// <returns>The result</returns>
        public static decimal PercentOf(this int position, float total)
        {
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)((decimal)position / (decimal)total * 100);
            return result;
        }
        /// <summary>
        /// The numbers percentage
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>The result</returns>
        public static decimal PercentageOf(this int number, double percent)
        {
            return (decimal)(number * percent / 100);
        }
        /// <summary>
        /// Percentage of the number.
        /// </summary>
        /// <param name="percent">The percent</param>
        /// <param name="number">The Number</param>
        /// <returns>The result</returns>
        public static decimal PercentOf(this int position, double total)
        {
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)((decimal)position / (decimal)total * 100);
            return result;
        }
        /// <summary>
        /// The numbers percentage
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>The result</returns>
        public static decimal PercentageOf(this int number, decimal percent)
        {
            return (decimal)(number * percent / 100);
        }
        /// <summary>
        /// Percentage of the number.
        /// </summary>
        /// <param name="percent">The percent</param>
        /// <param name="number">The Number</param>
        /// <returns>The result</returns>
        public static decimal PercentOf(this int position, decimal total)
        {
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)position / (decimal)total * 100;
            return result;
        }
        /// <summary>
        /// The numbers percentage
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>The result</returns>
        public static decimal PercentageOf(this int number, long percent)
        {
            return (decimal)(number * percent / 100);
        }
        /// <summary>
        /// Percentage of the number.
        /// </summary>
        /// <param name="percent">The percent</param>
        /// <param name="number">The Number</param>
        /// <returns>The result</returns>
        public static decimal PercentOf(this int position, long total)
        {
            decimal result = 0;
            if (position > 0 && total > 0)
                result = (decimal)position / (decimal)total * 100;
            return result;
        }
        #endregion
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
来看几个测试用例,增强对它的直观感受,因为涉及到的数值类型多一些,所以扩展方法的数量也多。
Assert.AreEqual(33.0M, 100.PercentageOf(33));
Assert.AreEqual(33.0M, 33.PercentOf(100));
Assert.AreEqual(33.0M, 100.PercentageOf((float)33.0F));
Assert.AreEqual(33.0M, 33.PercentOf((float)100.0F));
Assert.AreEqual(33.0M, 100.PercentageOf((double)33.0F));
Assert.AreEqual(33.0M, 33.PercentOf((double)100.0F));
Assert.AreEqual(33.0M, 100.PercentageOf((decimal)33.0M));
Assert.AreEqual(33.0M, 33.PercentOf((decimal)100.0M));
Assert.AreEqual(33.0M, 100.PercentageOf((long)33));
Assert.AreEqual(33.0M, 33.PercentOf((long)100));
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.NET开发中经常用到的扩展方法的更多相关文章
- java开发中遇到的问题及解决方法(持续更新)
		摘自 http://blog.csdn.net/pony12/article/details/38456261 java开发中遇到的问题及解决方法(持续更新) 工作中,以C/C++开发为主,难免与其他 ... 
- IOS开发中数据持久化的几种方法--NSUserDefaults
		IOS开发中数据持久化的几种方法--NSUserDefaults IOS 开发中,经常会遇到需要把一些数据保存在本地的情况,那么这个时候我们有以下几种可以选择的方案: 一.使用NSUserDefaul ... 
- Android应用开发中三种常见的图片压缩方法
		Android应用开发中三种常见的图片压缩方法,分别是:质量压缩法.比例压缩法(根据路径获取图片并压缩)和比例压缩法(根据Bitmap图片压缩). 一.质量压缩法 private Bitmap com ... 
- 浅谈Excel开发:九 Excel 开发中遇到的常见问题及解决方法
		Excel开发过程中有时候会遇到各种奇怪的问题,下面就列出一些本人在开发中遇到的一些比较典型的问题,并给出了解决方法,希望对大家有所帮助. 一 插件调试不了以及错误导致崩溃的问题 在开发机器上,有时可 ... 
- 关于html+ashx开发中几个问题的解决方法
		在跟html+ashx打交道的园友们肯定会发现,这种模式虽然优美,但在开发中会遇到一些难处理的地方.我也不例外,下面是自己在实际开发中总结出来的几条经验,希望跟大家分享,更希望得到大家的建议和更好的解 ... 
- 关于html+ashx开发中几个问题的解决方法 (转)
		在跟html+ashx打交道的园友们肯定会发现,这种模式虽然优美,但在开发中会遇到一些难处理的地方.我也不例外,下面是自己在实际开发中总结出来的几条经验,希望跟大家分享,更希望得到大家的建议和更好的解 ... 
- droid开发中监听器的三种实现方法(OnClickListener)
		Android开发中监听器的实现有三种方法,对于初学者来说,能够很好地理解这三种方法,将能更好地增进自己对android中监听器的理解. 一.什么是监听器. 监听器是一个存在于View类下的接口,一般 ... 
- phpcms模块开发中的小问题及解决方法
		1.模块菜单中文名出错 在编写安装模块时候可能需要更改extention.inc.php中定义中文名称,由于反复安装或者通过phpcms的扩展->菜单管理 修改菜单名会导致中文名失败.解决办法很 ... 
- Hive开发中使用变量的两种方法
		在使用hive开发数据分析代码时,经常会遇到需要改变运行参数的情况,比如select语句中对日期字段值的设定,可能不同时间想要看不同日期的数据,这就需要能动态改变日期的值.如果开发量较大.参数多的话, ... 
随机推荐
- Unity3D手游开发日记(9) - 互动草的效果
			所谓互动草,就是角色跑动或者释放技能,能影响草的摆动方向和幅度. 前面的文章早已经实现了风吹草动的效果,迟迟没有在Unity上面做互动草,是因为以前我在端游项目做过一套太过于牛逼的方案.在CE3的互动 ... 
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
			ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 背景: mys ... 
- 如何正确接收 GitHub 的消息邮件
			背景 我厂的开发流程通常都是基于 GitHub 的.在 GitHub 上 review 代码,也是我日常工作的重要组成部分.对我来说,在 code review 过程中最讨厌的莫过于,我在 pull ... 
- SQL Server 树查询
			WITH treeAS(SELECT ParentAssetID, AssetID,1 AS x2level,nodename,CAST(nodename AS NVARCHAR(max)) x2na ... 
- Android入门
			在学Android,摘自<第一行代码——Android> 布局管理 通过xml文件进行布局管理. android:id="@+id/button_1" 为当前的元素定义 ... 
- Android照片墙应用实现,再多的图片也不怕崩溃
			本文首发于CSDN博客,转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/9526203 照片墙这种功能现在应该算是挺常见了,在很多应用 ... 
- nginx 版本介绍
			Nginx官网提供了三个类型的版本Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以说是开发版Stable version:最新稳定版,生产环境上建议使用的版 ... 
- opengles tutorial
			https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide ... 
- java复习基础知识——java保留字
			ava 关键字列表 (依字母排序 共51组): abstract, assert,boolean, break, byte, case, catch, char, class, const, cont ... 
- Please set registry key HKLM\Microsoft\.NET Framework\InstallRoot to point to the .NET Framework
			安装.NET程序时会提示“Please set registry key HKLM\Microsoft\.NET Framework\InstallRoot to point to the .NET ... 
