Without converting to a string you could try
Math.Floor(Math.Log10(n) + 1);
More Related Contents:
- Random.Next returns always the same values [duplicate]
- How to tell whether a point is to the right or left side of a line
- Is double Multiplication Broken in .NET? [duplicate]
- Mod of negative number is melting my brain
- Evaluate string with math operators [duplicate]
- C# Math calculator [duplicate]
- Algorithm for simplifying decimal to fractions
- Make a sphere with equidistant vertices
- Built in .Net algorithm to round value to the nearest 10 interval
- How to elegantly check if a number is within a range?
- Arbitrary-Precision Decimals in C# [duplicate]
- Fixed point math in C#
- How to get the closest number from a List with LINQ?
- What is the easiest way to subtract time in C#?
- How to round up value C# to the nearest integer?
- Generic C# Code and the Plus Operator [duplicate]
- get closest point to a line
- Rounding up to 2 decimal places in C#
- Performing Math operations on decimal datatype in C#?
- Creating a Math library using Generics in C#
- What’s the quickest way to compute log2 of an integer in C#?
- Rotate image math (C#)
- Octal equivalent in C#
- How do I calculate a trendline for a graph?
- Algorithm for Calculating Binomial Coefficient
- The algorithm to find the point of intersection of two 3D line segment
- Basic render 3D perspective projection onto 2D screen with camera (without opengl)
- Why does Math.Exp give different results between 32-bit and 64-bit, with same input, same hardware
- Formatting Large Numbers with .NET
- How to round a integer to the close hundred?