Skip to content

Instantly share code, notes, and snippets.

@lisysolution
Created August 2, 2015 13:51
Show Gist options
  • Save lisysolution/54123b9c6196a62c00a8 to your computer and use it in GitHub Desktop.
Save lisysolution/54123b9c6196a62c00a8 to your computer and use it in GitHub Desktop.
C# 6.0 새기능 - 문자열 내에 코드 서식 직접 삽입 가능
Rectangle r = new Rectangle();
r.Height = 10;
r.Width = 32;
// Format string 앞에 $ 를 붙인다
// {} 안에 속성 혹은 계산식 등을 넣을 수 있다.
string s = $"{r.Height} x {r.Width} = {(r.Height * r.Width)}";
Console.WriteLine(s);
// <결과>
// "10 x 32 = 320"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment