I use the following mechanism in my code
public static int GetDecimalLength(string tempValue)
{
int decimalLength = 0;
if (tempValue.Contains('.') || tempValue.Contains(','))
{
char[] separator = new char[] { '.', ',' };
string[] tempstring = tempValue.Split(separator);
decimalLength = tempstring[1].Length;
}
return decimalLength;
}
decimal input=3.376; var instring=input.ToString();
call GetDecimalLength(instring)