【问题标题】:Naming object and its string representation命名对象及其字符串表示
【发布时间】:2023-03-29 21:40:02
【问题描述】:

先生们,我的代码中有很多地方方法接收原始用户输入为string,然后将TryParses 接收为实际数据类型(decimalenum 等)。我按其实际用途命名的对象(例如,decimal amount)。但我想不出原始strings 的最佳命名约定是什么? rawAmount? amountString? amount_raw?别的东西?请让我知道你的想法。

【问题讨论】:

  • inputAmount 和 actualAmount 怎么样

标签: c# naming-conventions naming


【解决方案1】:

我总是去:

string amountStr = GetInput();
double amount = double.Parse(amountStr);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-26
    • 2012-12-15
    • 2018-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多