The correct lines of code are
MyRoles = Role.List(null, true);
MyRoles.Insert(0, new Role { Name = "Administrator", Open = true, Type =
null });
You were trying to assign the result of the Insert method (or the lack
thereof) to MyRoles. Instead, you should assign the result of your
Role.List() method to your List reference and then just call Insert() on the
new instance.
--
Stanimir Stoyanov
http://stoyanoff.info
"shapper" <md*****@gmail.comwrote in message
news:44**********************************@v22g2000 pro.googlegroups.com...
On Nov 5, 7:55 pm, "Jeff Johnson" <i....@enough.spamwrote:
"shapper" <mdmo...@gmail.comwrote in message
news:73**********************************@w24g2000 prd.googlegroups.com...
After I add all roles I need to add a new role at the start of the
list.
Look at the Insert() method.
Yes, I have tried it as follows:
MyRoles = Role.List(null, true).Insert(0, new Role { Name =
"Administrator", Open = true, Type = null });
Role.List returns an IList<Role>
But I get the following error:
Cannot implicitly convert type 'void' to
'System.Collections.Generic.IList<MyApp.Role>'
Any idea why this is happening?
Thanks,
Miguel