Created
August 16, 2013 03:43
-
-
Save uzzu/6247138 to your computer and use it in GitHub Desktop.
nullを許容しない型はnull許容型で取得しようね <http://msdn.microsoft.com/ja-jp/library/vstudio/2cf62fcy.aspx>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using NUnit.Framework; | |
| using System.Collections.Generic; | |
| [TestFixture] | |
| public class DictionaryWithNullValueTest | |
| { | |
| [Test] | |
| public void DictionaryCanGetNullableInteger() | |
| { | |
| Dictionary<string, object> dict = (Dictionary<string, object>) MiniJSON.Json.Deserialize("{ \"hoge\": null }"); | |
| Assert.True(dict.ContainsKey("hoge")); | |
| int? hoge = (int?) dict["hoge"]; | |
| Assert.IsNull(hoge); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment