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
  • 相关阅读:
    服务管理--systemctl命令
    dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
    QML与Qt C++ 交互机制探讨与总结
    sync命令
    linux 下shell中if的“-e,-d,-f”是什么意思
    POJ 1936 All in All(模拟)
    POJ 1088 滑雪(记忆化搜索)
    POJ 3280 Cheapest Palindrome(DP 回文变形)
    POJ 3181 Dollar Dayz(高精度 动态规划)
    HDU 1114 Piggy-Bank(完全背包)
  • 原文地址:https://www.cnblogs.com/zhiying678/p/3088001.html
Copyright © 2011-2022 走看看