丸め
- 切り捨て:
Math.Floor
- 切り上げ:
Math.Ceiling
- 四捨五入:
Math.Round
ドキュメント:
Math.Floor | Microsoft Learn [公式]
Math.Ceiling | Microsoft Learn [公式]
Math.Round | Microsoft Learn [公式]
参考:
小数点を切り捨て、切り上げ、四捨五入する | dobon.net
整数の桁数を取得する
int digits = Math.Log10(decimal) + 1;
Code language: C# (cs)
参考:
序数を表示する
参考:
Is there an easy way to create ordinals? – Stack Overflow
Is there an easy way in .NET to get “st”, “nd”, “rd” and “th” endings for numbers? – Stack Overflow
Printing out ordinals – Stack Overflow
文字列定数
nameof
: 変数、型、メンバーの名前を文字列定数として取得する (コンパイル時に評価される)
ドキュメント:
参考:
キーワード
ドキュメント:
参考: