Formatting numbers with significant figures in C#
问题 I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I\'d like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it\'ll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occasionally it will be 4 or 5. Is there any convenient way to handle this? 回答1: See: RoundToSignificantFigures by "P Daddy". I've combined his method with another one I liked. Rounding