I have inherited code which I have had to decompile,
From the code I am getting one problem which I can not solve, Casting a object to HtmlString to T
if (typeof(T) == typeof(IHtmlString))
{
return (T)(new HtmlString(value.ToString()));
}
The errors on build as a invalid cast expression, I have tried to use Convert.ChangeType but that also doesn't work.
return (T)Convert.ChangeType(new HtmlString(value.ToString()), typeof(T));
Starting to run out of idea's, anyone have any solution?
Aucun commentaire:
Enregistrer un commentaire