You declare a constructor for the class HelpText that returns a value - a string. Constructors do not return any type. They just construct the object of the type. You should move the code that returns your constructed string to another method. Although, you can still build the string in the constructor and store it in a member variable.
--
Cezary Nolewajka
mailto:c.*********************@no-sp-am-eh-mail.com
remove all "no-sp-am-eh"s to reply
"Nik" <an*******@discussions.microsoft.com> wrote in message news:90****************************@phx.gbl...
I keep getting the following error 'member names cannot be
the same as their enclosing type' with the code below.
public class HelpText
{
private string _textToDisplay;
private string _cssClass;
public string TextToDisplay {
get {return _textToDisplay;}
set {_textToDisplay = value;}
}
public string CssClass {
get {return _cssClass;}
set {_cssClass = value;}
}
public string HelpText()
{
WebAuthorContext authorContext =
WebAuthorContext.Current();
//Check if in edit mode
if (authorContext.Mode ==
WebAuthorContextMode.AuthoringNew || authorContext.Mode ==
WebAuthorContextMode.AuthoringReedit) {
HelpText = "<span
class=\"" + CssClass + "\">" + TextToDisplay + "</span>";
}
} }
any ideas?