S
shapper
Hello,
I have the following method:
public static IEnumerable GetRoles(CultureInfo culture, bool open)
{
switch (culture.TwoLetterISOLanguageName.ToLower()) {
case "en":
return new[] {
new { Name = Role.Administrator, Description =
"Administrador", open = false },
new { Name = Role.Collaborator, Description =
"Colaborador", open = true }
}.OrderBy(r => r.Description);
}
return null;
}
Basically, what I would like to do, but not knowing if possible is:
- Create the items in a generic way (Not creating a class for this):
new { Name = Role.Administrator, Description = "Administrador", open
= false }
- Being able to use Linq on the result:
GetRoles(new CultureInfo("en-GB" , true)).Where(r => r.open = false)
I think I will need always to use List<RoleClass> right?
Thanks,
Miguel
I have the following method:
public static IEnumerable GetRoles(CultureInfo culture, bool open)
{
switch (culture.TwoLetterISOLanguageName.ToLower()) {
case "en":
return new[] {
new { Name = Role.Administrator, Description =
"Administrador", open = false },
new { Name = Role.Collaborator, Description =
"Colaborador", open = true }
}.OrderBy(r => r.Description);
}
return null;
}
Basically, what I would like to do, but not knowing if possible is:
- Create the items in a generic way (Not creating a class for this):
new { Name = Role.Administrator, Description = "Administrador", open
= false }
- Being able to use Linq on the result:
GetRoles(new CultureInfo("en-GB" , true)).Where(r => r.open = false)
I think I will need always to use List<RoleClass> right?
Thanks,
Miguel