Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

How to truncate a decimal without rounding

var value = 1.23456M;
var shortenedValue = Convert.ToDecimal(value.ToString("0.###"));

Assert.Equals(shortenedValue, 1.234);
1234
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# dictionary key set 
Csharp :: stackoverflow array c# 
Csharp :: C# walk down a tree and back 
Csharp :: xamarin forms uwp button hover 
Csharp :: c sharp switch forms 
Csharp :: asp.net core mvc razor page call pagemodel actio 
Csharp :: ASP.MVC display image from SqlServer 
Csharp :: VideoPlayer.isPlaying 
Csharp :: ########## 
Csharp :: my object is falling unity 
Csharp :: asp.net mvc class="" inline select 
Csharp :: c# open explorer and select file 
Csharp :: c# try catch multiple catches 
Csharp :: How to scroll to bottom of ListBox 
Csharp :: Cursor Button Lock and Area limitation 
Csharp :: what is the default value for an enum c# 
Csharp :: trigger enter with nav mesh 
Csharp :: Razor while loop 
Csharp :: bubble sort recursive c# 
Csharp :: how to download things c# 
Csharp :: asp.net Read raw Body 
Csharp :: leantween unity when timescale 0 
Csharp :: c# convert 1 to 01 
Csharp :: how to center a window in monogame 
Csharp :: what is C# 
Csharp :: Show Form on Second Monitor 
Csharp :: internal static object ds 
Csharp :: how to colapse all methods visual studio 
Csharp :: C# create delegate type at runtime 
Csharp :: how to trigger event when a com device is connected in c# 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =