Googler

两情相悦,又岂在朝朝暮暮。

随笔分类 -  C#.Net

上一页 1 2 3 4 5 6 7 下一页

C#.Net
Socket 实现HttpClient
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics.Contracts;using System.Collections.Specialized;using System.IO;using System.Net;using System.Net.Sockets;using System.Net.Security;using System.Net.Mime;using System.Reflection;namespace Rocky. 阅读全文

posted @ 2013-03-18 18:54 RockyLOMO 阅读(1831) 评论(1) 推荐(0)

MD5Hash16
摘要:public static string MD5Hash16(string input) { return MD5Hash16(Encoding.UTF8.GetBytes(input)); } public static string MD5Hash16(byte[] input) { var hasher = MD5.Create(); byte[] data = hasher.ComputeHash(input); string ... 阅读全文

posted @ 2013-03-04 10:23 RockyLOMO 阅读(299) 评论(0) 推荐(0)

Emit Method Generator
摘要:View Code using System;using System.Reflection.Emit;namespace Rocky{ /// <summary> /// ForState /// </summary> internal class ForState { private Label beginLabel; private object end; private Label endLabel; private LocalBuilder indexVariable; private... 阅读全文

posted @ 2013-03-01 18:54 RockyLOMO 阅读(474) 评论(1) 推荐(0)

Release Validator
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;namespace Rocky{ /// <summary> /// Release下会忽略此类所有方法 /// </summary> [DebuggerStepThrough] public static class Validator { #region Fields public const string Debu... 阅读全文

posted @ 2013-03-01 17:32 RockyLOMO 阅读(215) 评论(0) 推荐(0)

分布式架构
摘要:1. 实体职责:1.1. PO(Persistant Object) 例如EntityFramework中生成的数据实体,映射数据库中的表结构;1.2. BO(Business Object) 对上层暴露的业务实体。架构师在开发初期定义的业务接口中所用到的实体;1.3. DTO(Data Transfer Object) 分布式服务(WebService/WCF)暴露的契约实体;1.4. VO(View Object) 例如ASP.NET MVC中的V(UI实体);1.5. 参考:http://www.cnblogs.com/BigTall/archive/2007/12/12/991779. 阅读全文

posted @ 2013-01-22 14:35 RockyLOMO 阅读(383) 评论(0) 推荐(0)

Nuget Hello World
摘要:NuGet (New-Get) is a Visual Studio extension that makes it easy to install and update third-party libraries and tools in Visual Studio.NuGet (http://nuget.org) 类似java的maven。有兴趣的可参考如下文献:http://www.cnblogs.com/dudu/archive/2011/07/15/nuget.htmlhttp://www.cnblogs.com/dudu/archive/2012/06/05/nuget_serve 阅读全文

posted @ 2013-01-21 14:44 RockyLOMO 阅读(596) 评论(0) 推荐(0)

Memcached 总结
摘要:Membase Server官网:http://www.couchbase.com/products-and-services/memcached推荐Client:https://github.com/enyim/EnyimMemcached/(Build:https://github.com/enyim/EnyimMemcached/wiki/Release-builds)Q:http://memcached.org,http://www.northscale.com/download.html,http://www.membase.com/downloads/membase-server- 阅读全文

posted @ 2013-01-21 14:42 RockyLOMO 阅读(292) 评论(0) 推荐(0)

CacheHelper
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web;using System.Web.Caching;namespace ClusterService.Common{ public static class CacheHelper { public static object Cache(string key) { return HttpRuntime.Cache[key]; ... 阅读全文

posted @ 2013-01-19 11:20 RockyLOMO 阅读(302) 评论(0) 推荐(0)

C# SOCKET 多线程多管道可断点传送大文件2(续)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Configuration;using System.Net;using System.Threading;using Rocky.Net;namespace Rocky.Test.Unit{ internal class FileTransferTest : IUnitTest { public void Run(object arg) { C... 阅读全文

posted @ 2013-01-11 12:36 RockyLOMO 阅读(1066) 评论(0) 推荐(0)

Socket模拟Ping
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;using System.Diagnostics;namespace Rocky.Net{ public class PingWatch { public static IPEndPoint Parse(string input) { var arr = input.Split(':');... 阅读全文

posted @ 2012-12-27 18:01 RockyLOMO 阅读(1125) 评论(1) 推荐(0)

进程守护
摘要:private class SetPID { public delegate void SETPID(uint iPID); [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] public static extern SETPID GetProcAddress(IntPtr hModule, string procName); } [DllImport("k... 阅读全文

posted @ 2012-11-14 22:22 RockyLOMO 阅读(410) 评论(0) 推荐(0)

DataReaderGetterGenerator
摘要:using System;using System.Text;using System.Data;using System.Reflection;using System.Reflection.Emit;using System.Collections.Generic;using System.CodeDom.Compiler;using Rocky;namespace System.Reflection.Emit{ /// <summary> /// DataReaderGetterGenerator /// </summary> public class DataR 阅读全文

posted @ 2012-11-14 17:55 RockyLOMO 阅读(195) 评论(0) 推荐(0)

保存指定品质的图片
摘要:/// <summary> /// 保存图片 /// </summary> /// <param name="srcImage">要保存的图片</param> /// <param name="quality">品质(1L~100L之间,数值越大品质越好)</param> /// <param name="filename">保存路径</param> public static void SaveImage(Image srcImage, 阅读全文

posted @ 2012-10-12 16:45 RockyLOMO 阅读(188) 评论(0) 推荐(0)

DynamicQueryable
摘要://Copyright (C) Microsoft Corporation. All rights reserved.using System;using System.Collections.Generic;using System.Text;using System.Linq;using System.Linq.Expressions;using System.Reflection;using System.Reflection.Emit;using System.Threading;namespace System.Data.Linq{ /// <summary> /// & 阅读全文

posted @ 2012-10-11 18:44 RockyLOMO 阅读(1941) 评论(0) 推荐(0)

垃圾JSON
摘要:public static string ToJson<T>(IEnumerable<T> enumerable) where T : new() { var tor = enumerable.GetEnumerator(); if (!tor.MoveNext()) { return "[]"; } StringBuilder result = new StringBuilder("["); var entityTyp... 阅读全文

posted @ 2012-05-24 16:03 RockyLOMO 阅读(291) 评论(0) 推荐(0)

通过HttpListener实现Web远程桌面
摘要:http://download.csdn.net/detail/w395115323/4216841 var client = new HttpClient("http://localhost/Backdoor/"); client.Form["action"] = "2"; client.Form["entry"] = "Rocky.WebTool.Backdoor.Main"; byte[] fileData = File.ReadAllB... 阅读全文

posted @ 2012-04-11 13:47 RockyLOMO 阅读(555) 评论(0) 推荐(0)

DAL调用SP时出现的异常处理
摘要:三种情形:1.执行SP时出错,如连接异常,数据库权限异常2.SP代码中抛出异常3.返回值/输出参数的值不符合约定后两种情形需要在异常发生时记录传入SP的参数值;业务逻辑层需要捕获并重抛,以保证UI层提供给用户友好的错误提示第一种情形出现时,中间层没必要干预,UI展现错误编码或模糊的错误消息,如系统忙 阅读全文

posted @ 2011-10-19 14:16 RockyLOMO 阅读(243) 评论(0) 推荐(0)

ZIP压缩/解压数据
摘要:public static byte[] Compress(byte[] data) { MemoryStream stream = new MemoryStream(); using (DeflateStream zipStream = new DeflateStream(stream, CompressionMode.Compress)) { zipStream.Write(data, 0, data.Length); return stream.To... 阅读全文

posted @ 2011-09-09 18:17 RockyLOMO 阅读(324) 评论(0) 推荐(0)

判断是否为ID串
摘要:/// <summary> /// 判断是否为ID串。 /// </summary> /// <example> /// 1,2,3,4,5,6,7 /// </example> /// <param name="intList">要判断的字符串</param> /// <returns></returns> public static bool IsIntParamsString(string paramsString) { if (string... 阅读全文

posted @ 2011-08-28 16:43 RockyLOMO 阅读(229) 评论(0) 推荐(0)

LINQ Select Distinct on Custom Class Property
摘要:http://www.craigwardman.com/blog/index.php/2008/11/linq-select-distinct-on-custom-class-property/ 阅读全文

posted @ 2011-08-23 19:18 RockyLOMO 阅读(221) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 下一页

导航

Apple/苹果笔记本 Mac Air MC968CH/A 行货在保 I5 11寸 超级本