“格式”的反义词是什么?
我正在创建一个业务项目格式化程序(传播),在显示时我想在乘以 100 后显示数字,并且出于所有计算目的,我想从显示(文本框)中读取数字,将其解析为双倍,然后除以它100.
SpreadFormatter {
public string Format(double originalValue){
//Please dont mind this logic/approach. I am just represeting the scenario.
return (originalValue * 100).ToString();
}
public double SuggestAName(string currentValue){
//Please dont mind this logic/approach. I am just represeting the scenario.
return Double.Parse(currentValue)/100 ;
}
}
我正在为上面的“SuggestAName”方法寻找合适的名称。
感谢您的关注。
I am creating a business item formatter (spread) where while displaying i want to display the number after multiplying it by 100, and for all calculation purpose i want to read the number from display (TextBox), parse it to double and then divide it 100.
SpreadFormatter {
public string Format(double originalValue){
//Please dont mind this logic/approach. I am just represeting the scenario.
return (originalValue * 100).ToString();
}
public double SuggestAName(string currentValue){
//Please dont mind this logic/approach. I am just represeting the scenario.
return Double.Parse(currentValue)/100 ;
}
}
I am looking for an appropriate name for "SuggestAName" method above.
Thanks for your interest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我倾向于认为
Parse
与Format
相反。要么这样,要么我采用“from”和“to”的方式,例如ToDisplayFormat
和FromDisplayFormat
。I tend to think of
Parse
as the opposite ofFormat
. Either that, or I go the way of "from" and "to", e.g.ToDisplayFormat
andFromDisplayFormat
.公共双解析(字符串currentValue)
public double Parse(string currentValue)