Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. LINQ
  4. Linq + Group by Problem [modified]

Linq + Group by Problem [modified]

Scheduled Pinned Locked Moved LINQ
helpcsharplinq
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EBeylo
    wrote on last edited by
    #1

    Hi All,

    var MyDataSet = (from devicesPermissions in userDevicePermissions
    where devicesPermissions.Username == "MyName"
    orderby devicesPermissions.IslandID, devicesPermissions.DeviceGroupsID,
    devicesPermissions.DevicesID
    group devicesPermissions by devicesPermissions.IslandsName).Distinct()

          foreach (var dataSet in MyDataSet)
             {
                Console.WriteLine(dataSet.Key);
    
                foreach (var devgro in dataSet)
                {
                    Console.WriteLine(devgro.DeviceGroupsID);
    
                     //Till here works fine like i want.
                  //\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
    
                    foreach (var devices in **devgro**) ////\*\*here i get an Error:
                     ///Error: foreach statement cannot operate on variables of type 'Vw\_MyView' because         'Vw\_MyView' does not contain a public definition for 'GetEnumerator'.	
                    {
                        Console.WriteLine(devices.**DevicesID**);
                    }
                }
    

    concerning my Code i want that it gives me this output: Key1 --DeviceGroup1 ----Devices1 ----Devices2 ----DeviceGroup2 --DeviceGroup3 Key2 --DeviceGroup4 ----Devices3 --DeviceGroup5 ----Devices4 ----Devices5 Please Help me !

    modified on Tuesday, December 16, 2008 6:11 AM

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups