• 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
  • 相关阅读:
    HDU 4725 The Shortest Path in Nya Graph(优先队列+dijkstra)
    POJ 3216 Repairing Company(二分图匹配)
    POJ 3414 Pots(bfs打印路径)
    POJ 3278 Catch That Cow(bfs)
    poj 3009 curling2.0 (dfs)
    用“道”的思想解决费用流问题---取/不取皆是取 (有下界->有上界) / ACdreamoj 1171
    hdu2448 / 费用流 / harbin赛区c题
    大数类模板(+-*/%等等)
    hdu4619 / 最大独立集
    hdu4888 多校B 最大流以及最大流唯一判断+输出方案
  • 原文地址:https://www.cnblogs.com/zhiying678/p/3088001.html
Copyright © 2020-2023  润新知