随笔分类 -  C#

摘要:在WebAPI工程入口不对外公开的接口不能使用public。 [HttpPost] public string PostRequest([FromBody] Model model) { /// } //Va... 阅读全文
posted @ 2015-03-11 10:57 Vincent.Dr 阅读(731) 评论(0) 推荐(0) 编辑
摘要:在NHibernate 3.3 中存储的字符串太长,会抛异常:The length of the string value exceeds the length configured in the mapping/parameter.有人会说这是新版NHibernate的一个Bug,3.2就不会出现... 阅读全文
posted @ 2014-04-23 17:16 Vincent.Dr 阅读(1092) 评论(0) 推荐(0) 编辑
摘要:When I added the file in VS I forgot to setBuild Action = Nonefrom the file properties. 阅读全文
posted @ 2014-04-10 15:24 Vincent.Dr 阅读(517) 评论(0) 推荐(0) 编辑
摘要:Error info:Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.Solution:This is becauseMicrosoft.Web.Infrastructureis not in your GAC. You need 阅读全文
posted @ 2014-04-02 13:36 Vincent.Dr 阅读(908) 评论(0) 推荐(0) 编辑
摘要:配置错误 不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况。锁定是默认设置的(overrideModeDefault="Deny"),或者是通过包含 overrideMode="Deny" 或旧有的 allowOverride="false" 的位置标记明确设置的。配置文件\\?\X(盘符):\目录名\目录名\web.config 配置源 104: 105: '//(这里红色标记) 106: 出现这个错误是因为 IIS 7 采用了更安全的 web.config 管理机制,默认情况下会锁住配置项不允许更改。 阅读全文
posted @ 2014-04-01 19:30 Vincent.Dr 阅读(359) 评论(0) 推荐(0) 编辑
摘要:Ctrl+E,D ----格式化全部代码 Ctrl+E,F ----格式化选中的代码 CTRL + SHIFT + B生成解决方案 CTRL + F7 生成编译 CTRL + O 打开文件 CTRL + SHIFT + O打开项目 CTRL + SHIFT + C显示类视图窗口 F4 显示属性窗口 SHIFT + F4显示项目属性窗口 CTRL + SHIFT + E显示资源视图 F12 转到定义 CTRL + F12转到声明 CTRL + ALT + J对象浏览 CTRL + ALT + F1帮助目录 CTRL + F1 动态帮助 F1 帮助 SHIFT + F1当前窗口帮助 CTRL + 阅读全文
posted @ 2014-03-24 17:05 Vincent.Dr 阅读(16228) 评论(0) 推荐(1) 编辑
摘要:CsvFileStream.cspublic class CsvFileStream { TextReader stream; bool EOS = false; bool EOL = false; public CsvFileStream(TextReader s) { stream = s; } public string[] GetNextRow() { ArrayList row = new ArrayList(); ... 阅读全文
posted @ 2014-03-14 15:24 Vincent.Dr 阅读(252) 评论(0) 推荐(0) 编辑
摘要:public class HttpWebResponseUtility { public static string CreateGetHttpResponse(string url) { var response = CreateGetHttpResponse(url, null); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); ... 阅读全文
posted @ 2014-03-14 15:12 Vincent.Dr 阅读(359) 评论(0) 推荐(0) 编辑
摘要:Info from :http://www.cnblogs.com/yugen/archive/2010/08/18/1802781.html1、用字符串分隔:usingSystem.Text.RegularExpressions;stringstr="aaajsbbbjsccc";string[]sArray=Regex.Split(str,"js",RegexOptions.IgnoreCase);foreach(stringiinsArray)Response.Write(i.ToString()+"");输出结果:aaabbb 阅读全文
posted @ 2014-03-07 16:43 Vincent.Dr 阅读(226) 评论(0) 推荐(0) 编辑
摘要:We need to configure Timestamp in Mapping.eg.Map(x => x.ResponseDate).CustomType("Timestamp"); 阅读全文
posted @ 2014-03-07 12:26 Vincent.Dr 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Info from :http://www.csharpwin.com/csharpspace/6253r7952.shtml本例子主要是介绍如何在 C#开发WinForm中加入一个组件,如果你想在窗体中加入任何组件,首先,你必须要初始化这个组件(见下面程序中初始化Label一样)。并且使用"Controls.Add"方法加入到窗体中,以下是程序运行的界面和源代码。 C#开发WinForm源程序:using System;using System.Windows.Forms;using System.Drawing;public class Form3 : Form{ // 阅读全文
posted @ 2014-03-04 16:51 Vincent.Dr 阅读(2175) 评论(0) 推荐(0) 编辑
摘要:两种方法:1.Rectangle rect = Screen.GetWorkingArea(this);int width = rect.Width;int height = rect.Height;2.Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;int width = rect.Width;int height = rect.Height; 阅读全文
posted @ 2014-03-02 10:32 Vincent.Dr 阅读(342) 评论(0) 推荐(0) 编辑
摘要:信息来自:http://blog.csdn.net/bigeyescat/article/details/5966540以下例子是将Word打开,然后将它嵌入到winform窗体中,效果如下图:注意:该方法只适用于com的exe(如word,Excel之类),.net的编的exe就不能用这用方法嵌入到窗体中。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.W 阅读全文
posted @ 2013-12-09 12:27 Vincent.Dr 阅读(1816) 评论(0) 推荐(0) 编辑
摘要:信息来自:http://blog.163.com/kunkun0921@126/blog/static/169204332201293023432113/using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;namespace ConsoleApp{ class ProcessDo { /// /// 获取进程相关信息 /// public static void ... 阅读全文
posted @ 2013-12-09 11:50 Vincent.Dr 阅读(809) 评论(0) 推荐(0) 编辑
摘要:public string Serialize(T serializeClass) { string xmlString = string.Empty; try { if (serializeClass != null) { XmlSerializer serializer = new XmlSerializer(typeof(T)); StringBuilder xmlStrin... 阅读全文
posted @ 2013-11-07 15:10 Vincent.Dr 阅读(748) 评论(0) 推荐(0) 编辑
摘要:信息来自:http://blog.csdn.net/renyouprince/article/details/4136176当我们在做WinForm的程序时,总是要弹出一些窗体,但弹出窗体看起来效果都不是很好,特别是弹出的窗体很多时,这时候就会影响整个软件的用户体验.所以还是要尽量的避免弹出窗体.我们可以用这样的方法来解决此问题,将父窗体作为容器,将字窗体显示到父窗体中,而不是作为弹出窗体.将弹出窗体显示在父窗体中,可在父窗体中加入一个Panel(或其他容器控件),然后将要弹出的窗体作为Panel的控件显示到Panel上.但此处要设置子窗体的两个属性:1.TopLevel,获取或设置一个值,该 阅读全文
posted @ 2013-10-27 08:05 Vincent.Dr 阅读(1521) 评论(0) 推荐(0) 编辑
摘要:xml如下: 4700203048783633 Failed to identify the card scheme of the supplied card number 1000001 TEST Invalid card type 21 1382512427原来的Entity如下: [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [Serializable()] [System.Diagnostics.DebuggerStepThroughAttribute 阅读全文
posted @ 2013-10-23 15:35 Vincent.Dr 阅读(2443) 评论(0) 推荐(0) 编辑
摘要:More info here:http://blogs.msdn.com/b/yojoshi/archive/2011/05/14/xml-serialization-and-deserialization-entity-classes-with-xsd-exe.aspxIntroductionMany time we come across the need ofparsing XML document and creating entities. These entities are later passed between multiple methods, stored as conf 阅读全文
posted @ 2013-10-21 13:59 Vincent.Dr 阅读(261) 评论(0) 推荐(0) 编辑
摘要:DateTimeFormatInfo pattern = new DateTimeFormatInfo() { ShortDatePattern = "your date pattern" };DateTime date = Convert.ToDateTime("your date string",pattern); 阅读全文
posted @ 2013-08-02 16:55 Vincent.Dr 阅读(260) 评论(0) 推荐(0) 编辑
摘要:This is a very old and well-known problem.There is no way to be absolutely certain a file being written by the FTP daemon is complete. It's even possible that the file transfer failed and then gets restarted and completed. You must poll the file's size and set a time limit, say 5 minutes. If 阅读全文
posted @ 2013-07-29 17:50 Vincent.Dr 阅读(225) 评论(0) 推荐(0) 编辑