title: Entity Framework Metadata LINQ (Converting from C# to VB.NET)
body: <p>I've got a query in C# that is working for me to query the metadata for the Entity Framework.  I need to convert it to VB.NET, but I'm struggling to convert the AS keyword to "cast" meta to System.Data.Metadata.Edm.EntityType.  I've tried TryCast, CType, Cast, etc.</p>
  
  <p>Here's the query in C#:</p>
  
  <pre><code>var queryResult = from meta in oc.MetadataWorkspace.GetItems(System.Data.Metadata.Edm.DataSpace.CSpace)
                    .Where(m =&gt; m.BuiltInTypeKind == System.Data.Metadata.Edm.BuiltInTypeKind.EntityType)
                                    from p in (meta as System.Data.Metadata.Edm.EntityType).Properties
                                    .Where(p =&gt; p.DeclaringType.Name == entityClassType.Name
                                    &amp;&amp; p.Name == propertyName)
                                    select p;
  </code></pre>
  
  <p>This is the closest I've come to getting it to compile in VB.NET (the As keyword in underlined and says ')' expected:</p>
  
  <pre><code>Dim query2 = _
               From meta In entityObjectContext.MetadataWorkspace.GetItems(System.Data.Metadata.Edm.DataSpace.CSpace) _
                    .Where(Function(m) m.BuiltInTypeKind = System.Data.Metadata.Edm.BuiltInTypeKind.EntityType) _
                    From p In (meta As System.Data.Metadata.Edm.EntityType).Properties _
                    .Where(Function(p) p.DeclaringType.Name = entity.GetType().Name _
                           And p.Name = propertyName) _
                    Select p
  </code></pre>
  
  <p>This is killing me.  I'm so close...</p>