Method that converts string expression into bold

312 Views Asked by At
    private string Bold(string str)
    {
        return Convert.ToString(new Font(Bold(str)));
    }

How can I convert a string text to bold in C#? I'm typing like this but I'm getting an error.

1

There are 1 best solutions below

0
Kacper Gwiazdowski On

It depends what you are trying to achieve. string itself shouldn't know anything about text style. The Font class that you have used is for presentation of the string but not for storing the string itself.

In web development presentation layer should be described in css, so I think you should use css font-weight property.