C# 一些小东东

  1. 在C#中,如果有一个方法我们不想继续使用,需要废弃的时候,可以在该方法前面加上一个[Obsolete]。
  2. string[] arr={"a","b"}
  3. if $(ConfigurationName)==Release copy /y $(TargetPath) E:\Develop\CommonDll
    if $(ConfigurationName)==Release copy /y $(TargetDir)LZL.XML E:\Develop\CommonDl

  4. vs 事件命令不要加"",会报错;
  5. [Conditional("DEBUG")]
    internal static void Log(object obj)
    {}

  6. vs发布网站时,报cs0006错误,切换成Release编译一下
  7. C#交互窗口可以直接运行C#代码,打开方式:视图》其他窗口》C#交互
  8. <configSections>
    <sectionGroup name="common">
    <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" requirePermission="false" />
    </sectionGroup>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
    <section name="SingleTagSectionTest" type="System.Configuration.SingleTagSectionHandler" />
    <section name="DictionarySectionTest" type="System.Configuration.DictionarySectionHandler" />
    <section name="NameValueSectionTest" type="System.Configuration.NameValueSectionHandler" />
    </configSections>

  9. volatile :volatile 关键字指示一个字段可以由多个同时执行的线程修改。声明为 volatile 的字段不受编译器优化(假定由单个线程访问)的限制。这样可以确保该字段在任何时间呈现的都是最新的值。

posted on 2015-02-09 10:53  木龙哥  阅读(164)  评论(0编辑  收藏  举报

导航