[Solved] Converting empty string to Char


You could try:

string productPreFix = new string(drpProductIdFix.SelectedValue.ToString()
                       .Take(1).ToArray());

Which will give you an empty string if the drpProductIdFix.SelectedValue.ToString() is an empty string.

Or:

string productPreFix = drpProductIdFix.SelectedValue != null ? 
                       new string(drpProductIdFix.SelectedValue.ToString()
                       .Take(1).ToArray()) : string.Empty;

If you need to check that SelectedValue isn’t null as well.

solved Converting empty string to Char