Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
Questionsave appointment on the shared exchange calendar Pin
maxim^18-Dec-17 23:22
maxim^18-Dec-17 23:22 
AnswerRe: save appointment on the shared exchange calendar Pin
OriginalGriff18-Dec-17 23:26
mveOriginalGriff18-Dec-17 23:26 
AnswerRe: save appointment on the shared exchange calendar Pin
Pete O'Hanlon19-Dec-17 4:03
subeditorPete O'Hanlon19-Dec-17 4:03 
Questionlambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
Krellon18-Dec-17 23:02
Krellon18-Dec-17 23:02 
AnswerRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
OriginalGriff18-Dec-17 23:25
mveOriginalGriff18-Dec-17 23:25 
GeneralRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
Krellon19-Dec-17 0:13
Krellon19-Dec-17 0:13 
GeneralRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
Richard Deeming19-Dec-17 2:19
mveRichard Deeming19-Dec-17 2:19 
GeneralRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
Krellon19-Dec-17 5:37
Krellon19-Dec-17 5:37 
Hi Homer, I thought the query might return all results in the collection where value == 802.11g and Object2 wasn't equal to null. I have so much to learn Smile | :)

I did a test run and you were right! all objects came back in the collection.

I have since implemented your recommendation and that worked Smile | :)

Here's my test code for ref.

using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp3
{
  class Program
  {
    static void Main(string[] args)
    {
      List<Object1> origCollection = new List<Object1>()
        {
          new Object1() {ID = 1, theList = new List<Object2>()
            {
              new Object2() { Name = "Mode", Value = "802.11b" },
              new Object2() { Name = "BW", Value = "20" },
              new Object2() { Name = "Chan", Value = "1" },
              new Object2() { Name = "Tech", Value = "SISO" }
            }
          },
          new Object1() { ID = 2, theList = new List<Object2>()
            {
              new Object2(){ Name = "Mode", Value = "802.11g" },
              new Object2(){ Name = "BW", Value = "20" },
              new Object2(){ Name = "Chan", Value = "1" },
              new Object2(){ Name = "Tech", Value = "SISO" }
            }
          }   
        };

        var theCollection0 = origCollection.Where(m => m.theList.Select(n => n.Value == "802.11b") != null); // Broken

        var theCollection1 = origCollection.Where(m => m.theList.Any(n => n.Value == "802.11b"));            // Works!
        var theCollection3 = origCollection.Where(m => m.theList.Any(n => n.Value == "802.11z"));            // Returns Empty as expected.
    }
  };


  class Object1
  {
    public int ID { get; set; }
    public List<Object2> theList; 
  }

  class Object2
  {
    public string Name { get; set; }
    public string Value { get; set; }
  }
}


Many thanks for spotting and fixing this! your a star Smile | :)

Br
Nigel
SuggestionRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
Richard Deeming19-Dec-17 2:17
mveRichard Deeming19-Dec-17 2:17 
GeneralRe: lambda expression to retrieve sequence based on an array value where the array is stored in the sequence Pin
OriginalGriff19-Dec-17 2:26
mveOriginalGriff19-Dec-17 2:26 
QuestionHaving trouble working with balls on Pong game in Windows forms in C# Pin
Wagner18-Dec-17 4:29
Wagner18-Dec-17 4:29 
AnswerRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Kenneth Haugland18-Dec-17 4:34
mvaKenneth Haugland18-Dec-17 4:34 
GeneralRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Wagner18-Dec-17 4:53
Wagner18-Dec-17 4:53 
AnswerRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Ron Nicholson18-Dec-17 5:25
professionalRon Nicholson18-Dec-17 5:25 
GeneralRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Wagner18-Dec-17 6:46
Wagner18-Dec-17 6:46 
AnswerRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Gerry Schmitz18-Dec-17 6:35
mveGerry Schmitz18-Dec-17 6:35 
GeneralRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Wagner18-Dec-17 7:28
Wagner18-Dec-17 7:28 
GeneralRe: Having trouble working with balls on Pong game in Windows forms in C# Pin
Gerry Schmitz18-Dec-17 7:45
mveGerry Schmitz18-Dec-17 7:45 
QuestionConfigure container in Bootstrapper with Unity Pin
Kenneth Haugland17-Dec-17 3:17
mvaKenneth Haugland17-Dec-17 3:17 
AnswerRe: Configure container in Bootstrapper with Unity Pin
Chris Quinn17-Dec-17 21:36
Chris Quinn17-Dec-17 21:36 
GeneralRe: Configure container in Bootstrapper with Unity Pin
Kenneth Haugland18-Dec-17 1:57
mvaKenneth Haugland18-Dec-17 1:57 
AnswerRe: Configure container in Bootstrapper with Unity Pin
Kenneth Haugland18-Dec-17 8:24
mvaKenneth Haugland18-Dec-17 8:24 
QuestionRegarding article post of mvc pagelist. Pin
Member 1320094417-Dec-17 3:15
Member 1320094417-Dec-17 3:15 
AnswerRe: Regarding article post of mvc pagelist. Pin
Afzaal Ahmad Zeeshan17-Dec-17 4:32
professionalAfzaal Ahmad Zeeshan17-Dec-17 4:32 
QuestionExceptions Thrown Back to Caller with No Details Pin
User9874317-Dec-17 1:30
professionalUser9874317-Dec-17 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.