当前位置:网站首页>C# 之 $ – 字符串内插
C# 之 $ – 字符串内插
2022-07-30 08:32:00 【InfoQ】
class Program
{
static void Main(string[] args)
{
DateTime date = DateTime.Now;
//我们通常是这么写,
Console.WriteLine("今天是{0}年{1}月{2}日", date.Year, date.Month, date.Day);
//$ 的用法
Console.WriteLine($"今天是{date.Year}年{date.Month}月{date.Day}日");
Console.WriteLine($"这是$内插时{{转译大括号}}");
}
}


class Program
{
static void Main(string[] args)
{
//$"{"String",正数右间距,负数左间距}|{"String",10}"
Console.WriteLine($"{"|Czhen",-10}|{"ya",10}|");
}
}

class Program
{
static void Main(string[] args)
{
Console.WriteLine(" ___________________");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine("|_________|_________|");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine($"{"|",-10}|{"|",10}");
Console.WriteLine("|_________|_________|");
}
}

边栏推荐
- 香港服务器iis配置web服务器如何操作?
- test2
- 浅论各种调试接口(JTAG、SWD、RDI、Jlink、Ulink、STlink)的区别
- 研发转至FAE(现场应用工程师),是否远离技术了?有前途吗?
- 积分专题笔记-曲线面积分三大公式
- 2022 Hangzhou Electric Multi-School 2nd Game
- sort函数使用cmp出错Line 22: Char 38: error: reference to non-static member function must be called
- 研发人员的悲剧——“庞氏骗局”
- Circuit analysis: constant current source circuit composed of op amp and triode
- Activating data potential Amazon cloud technology reshapes cloud storage "family bucket"
猜你喜欢

HCIP --- MPLS VPN实验
![ES报错处理-mapper [xx.xx] of different type, current_type [text], merged_type [keyword]](/img/48/064348ec4d7c2a4fa6ffe7a4778ced.png)
ES报错处理-mapper [xx.xx] of different type, current_type [text], merged_type [keyword]

Leetcode - 990: equations of satisfiability

Access to display the data
![[Mini Program Column] Summarize the development specifications of uniapp to develop small programs](/img/7b/110d324eba00652e4987bc623a5bc6.png)
[Mini Program Column] Summarize the development specifications of uniapp to develop small programs

function (1)

经典毕业设计:基于SSM实现高校后勤报修系统

统一异常处理导致ResponseBodyAdvice失效

【HMS core】【FAQ】HMS Toolkit典型问题合集1

hicp第六天
随机推荐
剖析SGI STL空间配置器(一 、辅助接口函数)
Concise Notes on Integrals - Types of Curve Integrals of the First Kind
EMC过不了?都是PCB工程师的锅?
ant-design form表单校验upload组件(附个人封装的上传组件)
MySQL中使用IN 不会走索引分析以及解决办法
一个低级错误导致的诡异现象——走近科学能拍三集,(C语言)最简单的数组元素读取,不正确!?
JS中如何阻止事件冒泡和默认行为
20220728使用电脑上的蓝牙和汇承科技的蓝牙模块HC-05配对蓝牙串口传输
Integral Special Notes - Definition of Integral
激活数据潜力 亚马逊云科技重塑云上存储“全家桶”
【三子棋】——玩家VS电脑(C语言实现)
2022杭电多校第一场
The FPGA based protocol 2: the I2C read and write E squared PROM
HashSet和LinkedHashSet
统一异常处理导致ResponseBodyAdvice失效
积分专题笔记-与路径无关条件
基于JSP实现校园二手交易平台
MySQL【运算符】
[Unity]UI切换环形滚动效果
最远点采样 — D-FPS与F-FPS