property or member definition wrong?

A

Andy B

I have a masterPage code file that looks like below file. For some reason I
keep getting compile error 1519: invalid token '{' in property or member
definition. I know it has something to do with my Menu property, because
when I comment it out or delete it then it works... any ideas?



using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using News;

using System.IO;

public partial class Layout : System.Web.UI.MasterPage

{

//return the main menu so other pages can use it.

public Menu {

get {

return MainMenu; }

}

protected void Page_Load(object sender, EventArgs e) {

}

}
 
J

Jon Skeet [C# MVP]

I have a masterPage code file that looks like below file. For some reason I
keep getting compile error 1519: invalid token '{' in property or member
definition. I know it has something to do with my Menu property, because
when I comment it out or delete it then it works... any ideas?

You haven't specified both the name and the type in the declaration.
You've got:

public Menu {

Is Menu the name or the type? If you want it to be both, you have to
say so:

public Menu Menu {

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top