Frazzle
Frazzle

Reputation: 157

What does this error mean: Member modifier 'public' must precede the member type and name

I have a problem with my viewresult for my index page. I have searched here and on Google for the solution. So here is my code.

public class UserController : Controller
{
    private ProjectsDB db = new ProjectsDB();
    //
    // GET: /User/
    EnvironmentVariableTarget 

    public ViewResult Index()
    {
        var model = from p in db.Projects where p.UserName == User.Identity.Name select p;
        return View(model);
    }

And this is my error:

Member modifier 'public' must precede the member type and name.

What am I doing wrong?

Upvotes: 7

Views: 31947

Answers (1)

pollirrata
pollirrata

Reputation: 5286

That EnvironmentVariableTarget part is wrong. It shouldn't be there, that's why you get the error on the next sentence

Upvotes: 11

Related Questions