I am trying to create a Extension Methods
for class string
. It is not appearing.
My class with the extension method:
namespace MEUPROJETO.Extension
{
public static class StringExtension
{
public static string PrimeiraLetraDeCadaPalavraMiuscula(this string frase)
{
frase = frase.ToLower();
System.Globalization.CultureInfo cultureinfo = System.Threading.Thread.CurrentThread.CurrentCulture;
return cultureinfo.TextInfo.ToTitleCase(frase);
}
}
}
Class where I try to use it:
namespace MEUPROJETO.Teste
{
public static class TesteExt
{
public static void teste( )
{
string catdescription = "TESTANDO a frase nessa STRING.";
catdescription = catdescription.PrimeiraLetraDeCadaPalavraMiuscula();
}
}
}
He can not even compile, says the method does not exist, how do I make it appear?
Does the namespace influence?