- 博客(31)
- 资源 (1)
- 收藏
- 关注
原创 关於 RWD (Reponsive Web Design 自适应网页设计) 的一点心得
关於 RWD (Reponsive Web Design 自适应网页设计) 的一点心得常说 One approach isn't necessarily better than the other. You have to pick the approach that works best with your personality (or your team's person
2015-04-17 08:32:12
1544
原创 一个资料表更新的语法
网友的问题: 请问个数据库问题,我有一张表有四个字段 id color sortNo name1 red 1 abc2 red 2 bcd3 red 3 efg4 green 1 1115 green
2015-01-11 18:14:16
499
翻译 关於 Parcelable 实作以及继承
看例子class Shape implements Parcelable { public int left; public int top; public int width; public int height; // CREATOR part is omitted protected Shape(Parcel in) { readFromParce
2015-01-11 13:40:34
2433
原创 几种遍历 List 的方法
遍历 List 的方法:1. for2. advanced for3. Iterator4. while5. ListIteratorList list1. forfor (int i = 0; i E element = list.get(i);}2. advanced forfor (E element : list) {
2015-01-09 17:14:32
704
原创 列示目录下的档案-套用多个过滤条件
要在某个目录下,找出相应多个副档名的档案。在 C# 4.0 以及之后的版本:var files = Directory.EnumerateFiles("C:\\path", "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".mp3") || s.EndsWith(".jpg"));C# 4.0 之前的版本:
2015-01-01 17:12:28
696
原创 C# Usage of CallerInformation
static void DisplayCallerInformation([CallerLineNumber] int callerLineNumber = 0,[CallerMemberName] string callerMemberName = "",[CallerFilePath] string callerFilePath = ""){ Console.WriteLine(st
2014-10-21 01:02:26
561
原创 C# 委托的发展 delegate, anonymous method and lambda
delegate int Add(int firstNumber, int secondNumber);.NET 1.x (1.0 - 1.1) Solution (C# 1.0)private int AddNumbers(int firstNumber, int secondNumber){ return firstNumber + secon
2014-10-21 00:46:40
517
原创 Invariance, covariance and contravariance
List stringList = new List(); //List objectList = stringList; // No. Invariance Parent p = new Parent(); Test(ref p); Child c = new Child();
2014-10-21 00:07:09
545
原创 C# vs Java
先学了 Java, 再学 C#结果工作大部份时间都在使用 C#觉得 Visual Studio 真的是非常棒的 IDEJava 和 C# 真的有太多相似的地方常有人会问学哪个好?我觉得要看从哪个角度来谈这件事如果你希望学习的快一些,我建议,学 C# ,至少 Visual Studio 帮了很大的忙但因为微软已经渐渐失去客户端的市场 (虽然在 PC 市场仍是霸主,但移动装
2014-10-20 00:45:47
1740
1
转载 jQuery selectors can be grouped into the following categories:
jQuery selectors can be grouped into the following categories:• Basic selector: Selects elements based on basic criteria such as ID, CSS class, andHTML tag name.• Basic filter: Filters an elemen
2014-10-16 10:06:00
968
原创 学习 HTML5
基本布局标签各种新增的控制标签输入检查(验证)播放和控制媒体WebSocket (聊天室)Canvas (绘图)本机储存IndexedDB图片存成档案GeolocationWeb Worker 多线程桌面提醒Drag and DropApp Cache
2014-10-15 21:21:06
517
原创 C# 6.0 (C# vNext) 新功能之:Semicolon operator
虽然这个功能在正式版本中可能不会有,但了解一下也无妨。Semicolon operator:分号运算符为何叫 operator?一般我们看到的,像加法、减法等运算符,但这个也叫操作法是为什麽?我们先看一下例子:var result = (var x = Foo(); Write(x); x * x);意思是:宣告变量 result宣告变量 x呼叫 Foo 方法将 Foo
2014-10-14 23:47:30
860
原创 C# 6.0 (C# vNext) 新功能之:Numeric Literal Formats
Numeric Literal Formats = Binary literals and separators个人解释为 「2 位元(2 进位)实字以及分隔符」以前可以用的,主要就十进位以及十位进位如下:var num1 = 1234; // 10 进位var num2 = 0x1234; // 16 进位2 进位实字怎麽宣告?var num3 = 0b1010; //
2014-10-14 23:11:45
1046
原创 C# 6.0 (C# vNext) 新功能之:Exception-Handling Improvements
在 C# 6.0 新功能裹的异常处理,有两个改进:异步处理(async and await)可以在 catch block 裹使用了。在 C# 5.0 推出的 async and await,当时不可以用於 catch block,现在已经可以了。支持异常过滤 exception filtering异步处理的例子:try{ WebRequest webRequest = We
2014-10-14 21:33:46
1208
原创 C# 6.0 (C# vNext) 新功能之:Expression Bodied Functions and Properties
Expression Bodied Function 可以用在:methodsuser-defined operatorstype conversionsread-only properties indexers看以下的例子:public class RgbColor(int r, int g, int b){ public int Red { get; } = r; p
2014-10-14 13:55:03
1694
原创 C# 6.0 (C# vNext) 新功能之:Event initializers
事件初始化(Event initializers)在 C# 6.0 新增功能,可以在建构实例时,直接初始化事件处理函式,如下:例一:new Customer { Notify += MyHandler };例二:var client = new WebClient{ DownloadFileCompleted += DownloadFileCompletedH
2014-10-13 22:40:47
1120
原创 C# 6.0 (C# vNext) 新功能之:Nameof Expressions
Nameof Expressions 故名思义就是取得名字的表达式。先看例子:以前的写法:void Foo(Bar bar){ if (bar == null) { throw new ArgumentNullException("bar"); }}新的写法:void Foo(Bar bar){ if (bar == n
2014-10-13 22:03:28
10195
原创 C# 6.0 (C# vNext) 新功能之:Null-Conditional Operator
Null-Conditional Operator 也叫 Null propagating operator看名字,应该就有点概念了。如果还不知道,提示一下:有个叫 Conditional Operator : 条件运算符(:?)也就是常会用到的:var result = (1 > 2) ? true : false;当括号内的结果为 true 时,回传第一个值,如果为 f
2014-10-13 01:05:07
2769
原创 C# 6.0 (C# vNext) 新功能之:Declaration Expressions
C# 6.0 (C# vNext) 新功能之:Declaration ExpressionsDeclaration Expressions 应该是叫宣告表达式。直接看代码。原先我们常写如下的式子:现在可以直接写成:if (!long.TryParse(Request.QureyString["Id"], out long id)){ }
2014-10-12 21:24:36
831
原创 C# 6.0 (C# vNext) 新功能之:Static Using Statements
Static Using Statements 这怎解释?看名称不解。如果改成 Using Statements for Static 会不会比较适当一点?这又是一个 C# 6.0 的语法糖(syntactic sugar)看一下例子:(从 MSDN 上找来的)
2014-10-12 13:55:26
1794
原创 如何检查一个档案是否被异动过,使用 CRC32
先说使用方法:Crc32 crc32 = new Crc32();String hash = String.Empty;using (FileStream fs = File.Open("c:\\myfile.txt", FileMode.Open)) foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").
2014-10-12 13:34:57
895
原创 修改 apk 默认的安装位置(不需要 Root)
步骤如下:1. 执行:adb shell2. 执行:pm get-install-location这时应该输出为 0 默认的位置3. 执行:pm set-install-location 2设定默认安装到 SD Card0 [auto]: Let system decide the best location1 [interna
2014-10-12 02:00:49
2455
原创 C# 6.0 (C# vNext) 新功能之:Auto-Properties with Initializers
Auto-Properties 其实正确应该是 Auto-Implemented Properties 也就是自动实作的属性。
2014-10-12 01:08:05
748
原创 C# 6.0 (C# vNext) 新功能之:Indexed Members and Element Initializers 索引的成員和元素初始化
// C# 3.0 支持的语法。集合初始项 Dictionarystring, string> builtInDataTypes = new Dictionarystring, string>() { {"Byte", "0 to 255"}, {"Boolean", "True or
2014-10-11 23:22:23
582
原创 如何检查一个档案是否被异动过,使用 MD5
当然检查档案的修改时间另外的方式,是计算 MD5 的值,代码如下: using (var md5 = new MD5CryptoServiceProvider()) { var buffer = md5.ComputeHash(File.ReadAllBytes(fileName)); var sb = ne
2014-10-10 13:59:46
735
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人