title: LINQ to Objects, query arrays in object
body: <p>I need to query an array. I have tried to use LINQ but with no success.</p>
  
  <p>Here is a simplified structure of Insurance </p>
  
  <pre><code>Public Class Insurance
         Public _typ As String
          Public _numb As Number()
          Public _indi As Indicator()
  End Class
  
  Public Class Number
          Sub New(ByVal n As String, ByVal i As String)
              Me._ntype = n
              Me._value = i
          End Sub
          Public _ntype As String
          Public _value As String
  
  End Class
  
  Public Class Indicator
          Sub New(ByVal it As String, ByVal ind As String)
              Me._itype = it
              Me._ind = ind
          End Sub
          Public _itype As String
          Public _ind As String
  End Class
  </code></pre>
  
  <p>Here I have construct a little example to explain how the array of Insurance looks. In real there is a Service who delivers the array to me.     </p>
  
  <pre><code>  Dim insarray(4) As Insurance
    Dim insa As New Insurance
    insa._typ = "SJUKVARD"
    insa._indi = New Indicator() {New Indicator("ST", "G"), New Indicator("TAX", "P"), New Indicator("PT", "6")}
    insa._numb = New Number() {New Number("PIN", "1000"), New Number("AGN", "A0001")}
    insarray(0) = insa
  
    Dim insa2 As New Insurance
    insa2._typ = "SJUKVARD"
    insa2._indi = New Indicator() {New Indicator("ST", "G"), New Indicator("TAX", "P")}
    insa2._numb = New Number() {New Number("PIN", "2000"), New Number("AGN", "A0002")}
    insarray(1) = insa2
  
    Dim insa3 As New Insurance
    insa3._typ = "SJUKVARD"
    insa3._indi = New Indicator() {New Indicator("ST", "G"), New Indicator("KAL", "T")}
    insa3._numb = New Number() {New Number("PIN", "3000"), New Number("AGN", "A0003")}
    insarray(2) = insa3
  
    Dim insa4 As New Insurance
    insa4._typ = "SJUKVARD"
    insa4._indi = New Indicator() {New Indicator("ST", "G"), New Indicator("TAX", "P")}
    insa4._numb = New Number() {New Number("PIN", "4000")}
    insarray(3) = insa4
  
    Dim insa5 As New Insurance
    insa5._typ = "SJUK"
    insa5._indi = New Indicator() {New Indicator("ST", "F"), New Indicator("TAX", "P")}
    insa5._numb = New Number() {New Number("PIN", "5000"), New Number("AGN", "A0005")}
    insarray(4) = insa5
  
    Dim myIns As IEnumerable(Of Object)
  
    myIns = ...(here should to LINQ question be)
  </code></pre>
  
  <p>In "myIns= ..." I want to construct a LINQ query which</p>
  
  <ul>
  <li>look for Insurances in the array which have _typ="SJUKVARD"</li>
  <li>and in the Insurance _numb array if some of the Number objects has
  _ntype="AGN"</li>
  <li>and in the Insurance _indi array if some of the Indicator objects has
  _itype="TAX"</li>
  <li>and in the Insurance _indi array if some of the Indicator objects has
  _itype="ST" AND _ind="G"</li>
  <li>and in the Insurance _indi array NOT has a Indicator objects with
  _type="PT</li>
  </ul>
  
  <p>So the only hit will be Insurance "insa2". Is this possible with LINQ?</p>
  
  <p>Hope someone can help me :)</p>