zoukankan      html  css  js  c++  java
  • LINQPad 应用

    https://www.linqpad.net/

    使用 LINQPad 调试linq以及lambda表达式

    http://www.studyofnet.com/news/1168.html

    linq 转化XML , 可以方便地把XML导出为CSV

    var path = @"d: emp ote.xml";
    var doc = XDocument.Load(path);
    doc.Dump();

    var q = from x in doc.Elements()
    select new {
    name=x.Attribute("name").Value
    ,to=x.Elements("to").FirstOrDefault().Value
    ,fromcol=x.Elements("from").FirstOrDefault().Value
    ,heading=x.Elements("heading").FirstOrDefault().Value
    ,body=x.Elements("body").FirstOrDefault().Value
    };

    q.Dump();

    linq查询EventLog

    string eventLogLocation = @"d:	empApplication.evtx";
    //var query = new EventLogQuery("Application", PathType.LogName, "*[System/Level=2]");
    string queryString = "*"; // XPATH Query
    EventLogQuery eventsQuery = new EventLogQuery(eventLogLocation, PathType.FilePath, queryString);
    EventLogReader logReader = new EventLogReader(eventsQuery);
    
    for (EventRecord eventInstance = logReader.ReadEvent();
        null != eventInstance; eventInstance = logReader.ReadEvent())
    {
    	//if(eventInstance.FormatDescription().Contains("SuanMing")){
    	    // Display event info
    	    Console.WriteLine("-----------------------------------------------------");
    		 Console.WriteLine("TimeCreated: {0}",eventInstance.TimeCreated.ToString());
    	    Console.WriteLine("Event ID: {0}", eventInstance.Id);
    	    Console.WriteLine("Publisher: {0}", eventInstance.ProviderName);
    	    Console.WriteLine("Description: {0}", eventInstance.FormatDescription());
    		String eventXml = eventInstance.ToXml();
    		Console.WriteLine(eventXml);
    	//}
    	
    }
    

      

  • 相关阅读:
    动态数据源切换
    Disconf实践指南:改造篇
    Disconf实践指南:使用篇
    Disconf实践指南:安装篇
    执行Git命令时出现各种 SSL certificate problem 的解决办法
    linux rz 乱码
    分布式配置项管理-开源方案预研究
    mac下mysql5.7.18修改root密码
    git 版本回滚
    关于@Autowired使用注意点
  • 原文地址:https://www.cnblogs.com/sui84/p/7350907.html
Copyright © 2011-2022 走看看