zoukankan      html  css  js  c++  java
  • C# learn note

    命名空间“System”中不存在类型或命名空间名称“Linq”(是缺少程序集引用吗?)

    写sharppcap的时候遇到的问题,解决方法,先把项目改成3.0 再改回3.5就好了。

    几种字符串转换,

    byte[] formal = new byte[] { 0x42, 0x51, 0x3, 0x6, 0x42, 0x51, 0x3, 0x6 };
    string tmpstr = Encoding.ASCII.GetString(formal);//转换为字符串 显示BQ
    Console.WriteLine(tmpstr);
    StringBuilder timestmpstr = new StringBuilder();
    timestmpstr.Append(BitConverter.ToString(formal)) ;//转换为字符串显示 显示为42-51
    Console.WriteLine(timestmpstr);
    Console.ReadLine();

    BQBQ
    42-51-03-06-42-51-03-06

    1  int val = int.Parse(num, NumberStyles.HexNumber);
    2         Console.WriteLine("{0} in hex = {1} in decimal.", num, val);
    3 
    4         // Parse the string, allowing a leading sign, and ignoring leading and trailing white spaces.
    5         num = "    -45   ";
    6         val = int.Parse(num, NumberStyles.AllowLeadingSign | 
    7             NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite);
    摘自MSDN

    看到一个note

    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.90).aspx

    When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. After adding the controls to the parent control, call the ResumeLayout method. This will increase the performance of applications with many controls.

    弄了半天label不显示,竟然是颜色的问题,坑爹啊!设置一下.backcolor属性就好分辨了

    关于控件UserControl Diy

    建立自己的控件之后,

    Project->Refresh Project ToolBox

    或者在“工具”菜单上单击“选项”项。 单击“Windows 窗体设计器”项下面的“常规”,并确保“AutoToolboxPopulate”选项设置为“True”。

    可通过改变UserControl的Anchor属性来设置界面

    2013年9月21日 15:36:44 关于Func<>

    看了段MSDN的代码http://msdn.microsoft.com/en-us/library/bb549151(VS.96).aspx#Mtps_DropDownFilterText

     1         private void ChangeModeDemo(object obin)
     2         {
     3             var localcontrol = obin as System.Windows.Forms.Control;
     4             string[] wordlist={"appLe","orange","bananA"};
     5             Func<string,string> GetUpper=s=>s.ToUpper();
     6             IEnumerable<string> word=wordlist.Select(GetUpper);
     7             foreach (var w in word)
     8             {
     9                 localcontrol.Text += w + "\n";
    10             }
    11         }
    View Code
  • 相关阅读:
    一个基础的C#的ACCESS操作类
    ASP.NET常用的三十三种实用代码
    在ASP.NET中使用MD5和SHA1加密
    一个比较漂亮的DataGrid样式表
    微软的面试题
    打印自定义纸张大小
    ASP.Net(C#)连接Oracle数据库的方法
    C#正则表达式应用范例
    matlab 字符串处理函数
    centos语言设置
  • 原文地址:https://www.cnblogs.com/zhiying678/p/3088001.html
Copyright © 2011-2022 走看看