Read Only Property

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I am defining a read only property that when the user access it gets a
SelectList generated by a method:

public SelectList Targets { get { return Asset.Targets(); } }

I get the error:
The modifier 'readonly' is not valid for this item

What am I doing wrong?

In VB.NET I should add ReadOnly but in C# I think I don't need to do
this.

Thanks,
Miguel
 
Hello,

I am defining a read only property that when the user access it gets a
SelectList generated by a method:

public SelectList Targets { get { return Asset.Targets(); } }

I get the error:
The modifier 'readonly' is not valid for this item

What am I doing wrong?

In VB.NET I should add ReadOnly but in C# I think I don't need to do
this.

Thanks,
Miguel

Solved. Somehow VS was giving the error even if everything was ok.
I then restarted it and now it is ok ... ate least it seems so.

Thanks,
Miguel
 
Solved. Somehow VS was giving the error even if everything was ok.
I then restarted it and now it is ok ... ate least it seems so.

Thanks,
Miguel

Strange!!!1 Restarting also became part of debugging now!!! (just
kidding)

-Cnu
 
Strange!!!1 Restarting also became part of debugging now!!! (just
kidding)

-Cnu

But really, I didn't do any change and suddenly I restarted and it
worked ...
.... I have been having also a few problems with MVC Intellisense that
becomes ok after restarting ... have no idea why.
 
Back
Top