Encodingã¯ã©ã¹ã¨BOMãããªãã®å¶å¾¡ãæ´æ°ãæ¨æºã¹ããªã¼ã (Consoleã¯ã©ã¹ã»Processã¯ã©ã¹)ã«ãããBOMåºåã®åä½ã追è¨
ä»å¹´ãAdvent Calendarã®å£ç¯ããã£ã¦ãã¾ããããå»å¹´ã¯ç§ã¯C#ã¨JavaScriptã§æ¸ãã¾ããããä»å¹´ã¯C#ã¨Silverlightã§ããã¾ããã¨ããããã§ããã®è¨äºã¯Silverlight Advent Calendar 2011ç¨ã®ã¨ã³ããªã§ããåæ¥ã¯@posauneããã®Silverlightã®ListBoxã§ã¤ããããã¡ãHorizontalTextBlock ã§ããã ä»åã®è¨äºä¸ã®ãµã³ãã«ã¯Silverlight 4ã§æ¸ãã¦ãã¾ããããSilverlightç¨ã¨ããä½è£ãæã¤ããã«Debug.WriteLineã§æ¸ãã¦ããã¨ããã ãã§ãSilverlightãããã¯çç¡ã§ãï¼ãã¼ã.NET 4ã§ãWindows Phone 7ã§ãé¢ä¿ãªãéãã話ã§ãããã ã·ãªã¢ã©ã¤ã¶ã使ãå ´é¢ æ¦ã3ã¤ã§ã¯ãªãã§ãããããå¤é¨ã§å ¬éããã¦ãããã¼ã¿(APIããããçµç±ã§å©ãã¨
DateTimeOffset æ§é ä½ DateTimeOffset æ§é ä½ã¯ãæ¥ä»ã¨æå»ã®å¤ãããã³ãã®å¤ã¨ UTC ã¨ã®å·®ç°ã示ããªãã»ããã表ãã¾ãã ãã®ãããå¤ã¯å¸¸ã«æ確ã«åä¸æç¹ãèå¥ãã¾ãã DateTimeOffset åã«ã¯ã DateTime åã®ãã¹ã¦ã®æ©è½ã«å ããã¿ã¤ã ã¾ã¼ã³ã®å¦çæ©è½ãå«ã¾ãã¾ãã ãã®ããã次ã®ãã¨ãå®è¡ããã¢ããªã±ã¼ã·ã§ã³ã«é©ãã¦ãã¾ãã åä¸ã®æç¹ãä¸æãã¤æ確ã«èå¥ããã DateTimeOffset åã使ç¨ãã¦ããç¾å¨ãã®æå³ãæ確ã«å®ç¾©ãããã©ã³ã¶ã¯ã·ã§ã³ã®æå»ãè¨é²ããã·ã¹ãã ã¤ãã³ãã¾ãã¯ã¢ããªã±ã¼ã·ã§ã³ ã¤ãã³ãã®æå»ãè¨é²ãããã¡ã¤ã«ä½ææå»ã¨ãã¡ã¤ã«å¤æ´æå»ãè¨é²ãããã¨ãã§ãã¾ãã ä¸è¬çãªæ¥ä»ã¨æå»ã®æ¼ç®ãå®è¡ããã ãã®æå»ã 2 ã¤ã®å¥ã ã®å¤ã¾ãã¯æ§é ä½ã® 2 ã¤ã®ã¡ã³ãã¼ã§ããå ´åãé¢é£ããè¤æ°ã®æå»ãä¿æããã
C# Advent Calendar 2011ãã¨ãããã¨ã§ãC# 4.0æ代ã®ããã°ã©ãã³ã°ã¹ã¿ã¤ã«ã«ã¤ãã¦èª¬æãã¦ã¿ã¾ããã¢ãã³ãã¨ããããã©ãææ¸ã®ããã«å¤æ çãªãã¨ãããªãã¦ããããåºæ¬çãªè©±ã®ã»ãã§ãããããã£ããã®ã¯ããã¢ããªã®ã§ã5.0ã«ãªãã°ã¾ãå¤ããã6.0ã«ãªãã°ã¾ãå¤ãããå¤ããã¾ããå¤ã話ãéã«åããããªããã¨(æ´å²ãç¥ãã®ã¯å¤§äºã ãã©ããã®ã¾ã¾ä¿¡ããã®ã¯å¥ã®è©±)ã常ã«ç¥èããªãã¬ãã·ã¥ããããã«ãããã¨ãããããã®ã大äºãããã§ããã ããã£ã¦ã¢ãã³ã«æ¸ããªãããã¡ï¼ãªãã¦ãã¨ã¯ããã¾ããããã ãç¥ããã¨ãå°ããã¤å¤ãã¦ãããã¨ãããããã®ã¯å¤§äºãããã£ã¦ã ã¨ããã§ããããç§ã®ä¸»è¦³ãããªãå ¥ã£ã¦ããã®ã§ããã®è¾ºã¯å·®ã£å¼ãã¦ãã ããã varã使ã C# 3.0ããæè¼ãããåæ¨è«ã§ã®å®£è¨ãåºãå½åã«ã¯æ£ã è°è«ããã£ã¦ãä»ããã¾ã«å¦ã®æè¦ãåºã¦ãããããã¾ãããva
ã©ããããã°ããã30æéãå¯ã¦ãªããã¼ãã¾ãããé°ã§çæ¼éã®å°±æ¥ä¸ã«ãã¤ããã¤ããã¦ã¾ãããï¼ã¡ãªã¿ã«GRAVITY DAZEã«ã¯ã¾ã£ã¦å»¶ã ã¨ãã¬ã¤ãã¦ãããå¯ã¦ãªãã ãã§ããPSé£å¶ã«ãã ããªãã¦ï¼ãã¦ãããã¯ããã¨ãã¦Blogæ´æ°é »åº¦ã®ä½ä¸ã£ã·ãã¯ãå¯ãä¸ããããããªãããªã§æè¿ã®ä»äºï¼ä»äºã§ãã£ã¦ï¼ä»äºãã¦ããã§ãã£ã¦ï¼ï¼ï¼ã¯ASP.NETãªãã§ãããè²ã ã¢ã¬ã§ããããµãµãµãã½ã¦ã«ã¸ã§ã ã¯çã£é»ã¨çã£ç½ãè¡ã£ããæ¥ãããã¦ã¦æ¥½ããã§ããã¾ããããããã«æ¥½ããã§ãã楽ããã®ã¯ããã¨ãã¦Blogãåæ»ããã®ã¯ãããªãã®ã§ãé»è»ã§GRAVITY DAZEãããªããQueryStringããããããããã¨ãæ¶ã ã¨ããã®ã§å¸°ãéã«æ®ºå®³ããç®æ®µãæ´ãã¦ãã¾ããã QueryStringã£ã¦ãqã¨ãnumã¨ãiã¨ãsã¨ãããããã®ãã®ã ãããä½ãæãã¦ããã¤ãããªã®ã§ãC#çã«ã¯ã¡ããã¨ååãã¤
ImplicitQueryString - CodePlex QueryStringãã£ãããã§ãããå¤æããã®ããintã«ãboolã«ããã以å¤ã«ããã®ã¾ã¾ããã©ããããããªãã¹ãã¬ã¹ãã«ãããã§ã以ä¸ã®ããã«æ¸ããã©ã¤ãã©ãªãä½ãã¾ãããå¿è«NuGetã§ã®ã¤ã³ã¹ãã¼ã«ãå¯è½ã§ãããã¨ãã©ã¤ãã©ãªã¨ãã£ã¦ãä¾ã«ãã£ã¦.csãã¡ã¤ã«ä¸åã ããªã®ã§ãå°å ¥ã¯è¶ ãæ軽ã 以ä¸ã¯ASP.NETã®ä¾ã§ãããNameValueCollectionã使ã£ã¦ãããã®ã¯å ¨ã¦å¯¾è±¡ã«ãªãã¾ããQueryStringã ããããªãã¦Request.Formãªã©ã«ã使ãã¾ããã // using Codeplex.Web; int count; string query; bool? isOrdered; // support nullable protected void Page_Load(object send
.NETéçºè ä¸å¿ å³é¸ããã°è¨äº LINQã®ä»çµã¿ï¼é 延è©ä¾¡ã®æ£ããåºç¤ç¥è ââ ããã°ãneue ccããã ââ æ²³å å®æ 2011/08/10 ã.NETéçºè ä¸å¿ å³é¸ããã°è¨äºãã·ãªã¼ãºã§ã¯ãä¸çä¸ã«ããè¨å¤§ãªããã°ã»ã³ã³ãã³ãã®ä¸ãããç¹ã«Insider.NETï¼.NETéçºè ä¸å¿ã®èªè ã«æç¨ã ã¨èããããããã°è¨äºãç·¨éé¨ãçºæã»å³é¸ãããã®ããã°è¨äºãå·çããããã¬ã¼ã®è¨±å¯ã®ä¸ããã®å ¨æã転è¼ã»ç¿»è¨³ãã¦ãã¾ãããã®æ´»åã«ããã.NETéçºè ã®ããã°æåã®ä¾¡å¤ã¨è³ªãé«ããããä¸å±¤ã®çãä¸ãã«è²¢ç®ãããã¨ãç®æãã¦ãã¾ãã æ¬ç¨¿ã§ã¯ãLINQã«ã¤ãã¦åºç¤ããç解ãããã¨ãç®çã«ããã®ä»çµã¿ã¨é 延è©ä¾¡ã«ã¤ãã¦æåãã解説ãã¾ãï¼â»ãä½ããã£ã¦æåï¼åºç¤ã¨ããããã¯äººã«ããç°ãªãã¨æãã¾ãããæ¬ç¨¿ã®è§£èª¬ã¯ããã¾ã§ãããããªãã®åºæºã«ãããåºç¤ã§ãï¼ã ãªããããã§ã¯LINQ
LINQæ¸ãã¦ãã¾ããï¼LINQã§ãã¼ã¿ãã¼ã¹æ´»ç¨ã¨ãè¦åºãã«ããã¾ããããã¼ã¿ãã¼ã¹æ´»ç¨ã¨ããã¤ã¤ããã®å å®ã¯100% LINQ to Objectsã§ããããããã¼ã¿ãã¼ã¹ã«ä½ã§åãåãããã£ã¦ãã®ï¼ã¨ããã¨ï¼ç¦åäºé ã§ãï¼ããã¦ããããªããã§æ¯æ¥LINQæ¸ãã¦ããããã§ãããããã¨ã¯å ¨ãé¢ä¿ãªããé åãçµæ§å°ã£ãã¡ãããä¾ãã°ä»¥ä¸ã®ãããªãé åãå ãã ã³ã¬ã¯ã·ã§ã³ãæä¾ãããã¨ãã¾ãã public class WrappedCollection<T> { T[] source; public WrappedCollection(T[] innerSource) { this.source = innerSource; } } ã§ãT[]ãªsourceãå ã«ã¡ã½ãããå¹¾ã¤ãæä¾ãããã¨ãããèªä½ã¯ãªããã¨ããªãã¨æããã¾ãããã¦ãCollectionãåä¹ã£ã¦ããã®ã§ãIEnumer
éåæã ããã ã£ã BUILD ã®å¾ã¨ããã®ããã£ã¦ãMSDN Blog ã MSDN Magazine ãéåæã ããã§ããããã»ãã¨ã ã¨ããããBUILD ã®ã»ãã·ã§ã³å 容ããã®ã¾ã¾è¨äºã«ãªã£ãæãã ããã¤ãã®è¨äºã«é¢ãã¦ãæ¦è¦ãã¡ã¢æ¸ãç¨åº¦ã«ï¼ Easier Asynchronous Programming with the New Visual Studio Async CTP http://msdn.microsoft.com/en-us/magazine/hh456401.aspx ãããã async ãå¿ è¦ã¨ãããçç±ã«é¢ãã¦ãå¿çæ§è¯ãããããã«ä»ã«ã©ãããæ段ãèãããã¦ããã®æ段ã ã¨ä½ãåé¡ãã説æã 解1: ã¹ã¬ããããããä½ã 確ãã«å¿çæ§ã¯æ¹å ãªã½ã¼ã¹ç¡é§é£ã ï¼ã»ã¨ãã©ã¯å¾ ã¡æéãªã®ã«ï¼å®¢ã®æ°ã ãã¦ã§ã¤ã¿ã¼éãããªã¼ãã¼ãã¨ã«2åãã¤ã³ãã¯éããããªç¡é§
async void ãé¿ãã 使ç¨ã§ããæ»ãå¤ã®åã«ã¯ãTaskãTask<T>ãããã³ void ã® 3 ã¤ãããã¾ãããasync ã¡ã½ããã§èªç¶ãªæ»ãå¤ã®å㯠Task 㨠Task<T> ã ãã§ããåæã³ã¼ãããéåæã³ã¼ãã«å¤æããéãå T ãè¿ãã¡ã½ããã¯ãã¹ã¦ Task<T> ãè¿ã async ã¡ã½ããã«ãªããvoid ãè¿ãã¡ã½ããã¯ãã¹ã¦ Task ãè¿ã async ã¡ã½ããã«ãªãã¾ãã次ã®ã³ã¼ã ã¹ããããã¯ãvoid ãè¿ãåæã¡ã½ããã¨ããã«ç¸å½ããéåæã¡ã½ããã示ãã¦ãã¾ãã void MyMethod() { // Do synchronous work. Thread.Sleep(1000); } async Task MyMethodAsync() { // Do asynchronous work. await Task.Delay(1000);
Dispose ã¡ã½ããã¯ã主ã«ç®¡ç対象å¤ãªã½ã¼ã¹ã解æ¾ããããã«å®è£ ããã¾ãã IDisposable ã®å®è£ ã§ããã¤ã³ã¹ã¿ã³ã¹ ã¡ã³ãã¼ã使ç¨ããå ´åã¯ãDispose å¼ã³åºããã«ã¹ã±ã¼ãããã®ãä¸è¬çã§ãã Dispose ãå®è£ ããã®ã¯ä»ã«ãçç±ãããã¾ãããã¨ãã°ãå²ãå½ã¦ãããã¡ã¢ãªã解æ¾ããããã³ã¬ã¯ã·ã§ã³ã«è¿½å ãããé ç®ãåé¤ããããåå¾ããã¦ããããã¯ã®ãªãªã¼ã¹ãéç¥ãããããããã§ãã .NET ã®ã¬ãã¼ã¸ ã³ã¬ã¯ã¿ã¼ã¯ãã¢ã³ããã¼ã¸ã ã¡ã¢ãªã®å²ãå½ã¦ã解æ¾ãè¡ãã¾ããã ç ´æ£ãã¿ã¼ã³ã¨å¼ã°ããããªãã¸ã§ã¯ããç ´æ£ãããã¿ã¼ã³ã«ãã£ã¦ããªãã¸ã§ã¯ãã®æå¹æéã«é çªãä»ãããã¾ãã dispose ãã¿ã¼ã³ã¯ãIDisposable ã¤ã³ã¿ã¼ãã§ã¤ã¹ãå®è£ ãããªãã¸ã§ã¯ãã«ä½¿ç¨ããã¾ãã ãã®ãã¿ã¼ã³ã¯ãã¬ãã¼ã¸ ã³ã¬ã¯ã¿ã¼ãã¢ã³ããã¼ã¸ã ãªãã¸ã§ã¯ããåå©ç¨ã§ããª
ãTIPSï¼WebRequestï¼WebResponseã¯ã©ã¹ã§Webãã¼ã¸ãåå¾ããã«ã¯ï¼ãã§ã¯ãï¼HTTPãããã³ã«ã®GETã¡ã½ããã«ããï¼Webãµã¼ãä¸ã®ãã¼ã¸ããã¡ã¤ã«ãªã©ããã¦ã³ãã¼ãããæ¹æ³ãç´¹ä»ãã¦ãããããããªããå®ã¯ãã®TIPSã示ããããª.NET Framework 1.xãã¼ã¹ã®æ¹æ³ã§ã¯ãHTTPå§ç¸®ããããã¡ã¤ã«ããã¦ã³ãã¼ããããã¨ãã§ããªãã£ãï¼HTTPå§ç¸®ãè¡ãããã«é常ã®ãã¡ã¤ã«ã®ã¾ã¾ãã¦ã³ãã¼ããè¡ãããï¼ã æ¬ç¨¿ã§è§£èª¬ãã.NETã®HTTPå§ç¸®ã§ã¯HTTPå§ç¸®ã¨ã¯ï¼â»2014/07/22ä¿®æ£ï¼ãHTTP 1.1ãããã³ã«ã®æ©è½ã§ãGZIPãã¡ã¤ã«ã»ãã©ã¼ãããï¼DEFLATEå§ç¸®ã¢ã«ã´ãªãºã ï¼ã«ããéä¿¡ãã¼ã¿ãå§ç¸®ããããããå©ç¨ãããã¨ã§è»¢ééãå¹³åã§30ï½50ï¼ ç¨åº¦ã«ç¸®å°ã§ãããå¾ã£ã¦ãç¹ã«ãããã¯ã¼ã¯å¸¯åå¹ ãçãç°å¢ã§å©ç¨ããã¨ãããã©ã¼ãã³ã¹ãé£
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}