开发者

What is the opposite of "Format"?

开发者 https://www.devze.com 2023-01-28 11:43 出处:网络
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

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.


I tend to think of Parse as the opposite of Format. Either that, or I go the way of "from" and "to", e.g. ToDisplayFormat and FromDisplayFormat.


public double Parse(string currentValue)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号