CSharp

[转]@RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别

1. RenderBody 在Razor引擎中没有了“母版页”,取而代之的是叫做“布局”的页面(_Layout.cshtml)放在了共享视图文件夹中。在这个页面中,会看到标签里有这样一条语句: 1 @RenderBody()@RenderBody() 其实它的作用和母版页中的服务器控件类似,当创建基于此布局页面的视图时,视图的内容会和布局页面...
赞 (0)阅读(74)

c#获取WebBrowser浏览器 登录后的cookie

通过调用非托管代码 可以获取完整的Cookie信息 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #region 获取cookie /// <summary> /// 获取cookie /// </summary> /// <param ...
赞 (0)阅读(62)

Csharp Unix时间戳和DateTime类型互转

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 #region 时间戳 相互转换   /// <summary> /// 将Unix时间戳转换为DateTime类型时间 /// </summary> /// <para...
赞 (0)阅读(112)

c# 对List集合进行平均分割

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #region 把一个集合平均分组后,最后不满一组的放到最后一个分组中 /// <summary> /// 把一个集合平均分组,最后不满一组的放...
赞 (0)阅读(214)

asp.net 学习记录01-ashx

以下是asp.net 第一课笔记(仅仅记录不知道的,之前没用过,或用的比较少的)  ashx (添加 一般处理程序) 类:HttpContext 虚拟路径转换为实际的物理路径  context.Request.MapPath(“reg.html”); 接受客户端表单数据:context.Request.Form 数据来自于POST 请...
赞 (0)阅读(73)

c#版文件MD5值和SHA1值计算

附上源码:[Downlink href=”http://www.phpstu.com/wp-content/uploads/2016/02/文件计算器.zip”]文件计算器.zip[/Downlink]   可能是我太小心了,总感觉去 网上下载那些 计算软件 不安全,就自己写一个,主要用到的是 System.Security...
赞 (0)阅读(59)

Linq 中 take_skip_takewhile_skipwhile 区别

linq 中这几个方法有时候会搞混(当然是因为不常用的原因),今天记录下,方便以后查看 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 4...
赞 (0)阅读(67)

c#unicode 转中文问题记录

有这么三种格式 &# 加十进制数字 &# xdbd 十六进制格式 还有一种是 \u 十六进制 不过最终都是要把后面的转成10进制,然后转换成char 再转换成字符串   public static string uncode(string str) { string outStr = “”; str = st...
赞 (0)阅读(47)

c# 正则匹配换行问题

之前用PHP写正则的时候 对于换行问题可以直接加模式s 就可以了。但c#中的一个Multiline 模式仅仅改变的是 ^ $ 的行为 经过尝试搜索解决 加上(?s)   (?s)<li gtype=.*?>.+?</li> 这样就可以让点号具有匹配换行符的能力 (?i) 进行不区分大小写的匹配 (?<name>&...
赞 (0)阅读(69)

C#递归遍历文件夹下所有文件

public static List<string> readDir(string path) { List<string> files = new List<string>(); if(!Directory.Exists(path)) { return null; } string[] dirs = Directory....
赞 (0)阅读(61)