C#6???????????????????
???????????? ???????[ 2016/6/6 10:49:31 ] ????????.NET ???????????
???????
????????????????????????????????C#6?????????6???????????仹?????????????????????????????????????????????????????????????????????????????????????Щ??Let’s try it.
????1????????????
//??????????????????????????????????????????????1???
public class Post
{
public DateTime DateCreated { get; private set; }
public List<Comment> Comments { get; private set; }
public Post()
{
DateCreated = DateTime.Now;
Comments = new List<Comment>();
}
}
public class Comment
{
}
//??????????????????????????????????????????????????
public class Post
{
public DateTime DateCreated { get; private set; } = DateTime.Now;
public List<Comment> Comments { get; private set; } = new List<Comment>();
}
public class Comment
{
}
????2???????????
??????????????????ж??????
var dictionary = new Dictionarystring?? string>
{
{ "key1"??"value1"}??
{ "key2"??"value2"}
};
//??????
var dictionary1 = new Dictionarystring?? string>
{
["key1"]="value1"??
["key2"]="value2"
};
????3??string.Format
????????????????????????????????????????string.Format??????StringBuilder?????????????????????????????
Post post = new Post();
post.Title = "Title";
post.Content = "Content";
//????????????????д
string t1= string.Format("{0}_{1}"?? post.Title?? post.Content);
//C#6????????????д???????????$??????????????????
string t2 = $"{post.Title}_{post.Content}";
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11