Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Truncate C#

decimal Truncate(decimal d, byte decimals)
{
    decimal r = Math.Round(d, decimals);

    if (d > 0 && r > d)
    {
        return r - new decimal(1, 0, 0, false, decimals);
    }
    else if (d < 0 && r < d)
    {
        return r + new decimal(1, 0, 0, false, decimals);
    }

    return r;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to call a method from a class c# 
Csharp :: c# copy an object 
Csharp :: unity fixedupdate 
Csharp :: static property in c# 
Csharp :: binary tree c# 
Csharp :: c# webclient vs httpclient 
Csharp :: adding to a dictionary class c# 
Csharp :: Implementing video array in unity 
Csharp :: System.Collections.Generic.List`1[System.Int32] c# fix 
Csharp :: Convert a string to Integer in C# without library function 
Csharp :: change tab to enter in c# form 
Csharp :: unity get quaternion z 
Csharp :: dadar pincode 
Csharp :: c# check multiple variables for null 
Csharp :: blazor conditional reenreing 
Csharp :: linq query to fetch parent child data from same table in c# 
Csharp :: how to change argument of function in f# 
Csharp :: asp.net session empty cehck 
Csharp :: unity editorwindowtitle obsolete 
Csharp :: how do you search for how many times a character appears in user input on c sharp 
Csharp :: how to navigate between page in wpf 
Csharp :: Running C# Example 
Csharp :: tomatch jest 
Csharp :: remove multiple element on list from index a to b C# 
Csharp :: external font family uwp c# 
Csharp :: last word of string to uppercase c# 
Csharp :: dispose await task c# 
Csharp :: csharp test for null 
Csharp :: ado .net nullable int datareader 
Csharp :: return a list of list from yaml via C# 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =