<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GetLayersAsFlattenedList in VB in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060526#M6595</link>
    <description>&lt;P&gt;Thanks Kris.&amp;nbsp; Yes, after a couple of hours of frustration I have abandoned VB and will for a full re-write in C#.&amp;nbsp; As you said, probably better to do it ASAP.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 17:33:38 GMT</pubDate>
    <dc:creator>BrianBulla</dc:creator>
    <dc:date>2021-05-21T17:33:38Z</dc:date>
    <item>
      <title>GetLayersAsFlattenedList in VB</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060407#M6589</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the misfortune of having to convert an ArcMap AddIn to ArcGIS Pro code.&amp;nbsp; Normally this isn't a problem, but this one happens to be built in VB.&amp;nbsp; I'd like to copy/paste as much 'non-SDK' code as possible so I'd like to keep things in VB as opposed to converting it to my language of choice C#.&lt;/P&gt;&lt;P&gt;Can anyone help convert the following bit of code from C# to VB?&amp;nbsp; Even googling, I can't seem to figure this&amp;nbsp; out:&lt;/P&gt;&lt;P&gt;FeatureLayer currentLayer = map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().Where(l =&amp;gt; l.Name.Equals(layerName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 13:54:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060407#M6589</guid>
      <dc:creator>BrianBulla</dc:creator>
      <dc:date>2021-05-21T13:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: GetLayersAsFlattenedList in VB</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060421#M6590</link>
      <description>&lt;P&gt;There are free converters online for C# to VB.Net but I don't know how well they will work with Linq.&lt;/P&gt;&lt;P&gt;Here is what I came up with:&lt;/P&gt;&lt;P&gt;Dim layer as FeatureLayer = map.GetLayersAsFlattenedList().OfType(Of FeatureLayer)().Where(Function(layer) layer.Name = layerName).FirstOrDefault()&lt;/P&gt;&lt;P&gt;To figure out the lamda expression, I searched for "lambda vb.net".&amp;nbsp; You can also search for "linq vb.net" for some samples as well.&lt;/P&gt;&lt;P&gt;HTH.&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 14:19:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060421#M6590</guid>
      <dc:creator>KrisCulin</dc:creator>
      <dc:date>2021-05-21T14:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: GetLayersAsFlattenedList in VB</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060423#M6591</link>
      <description>&lt;P&gt;Thanks Kris,&lt;/P&gt;&lt;P&gt;After some more trial and error I finally got something that worked:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim fLayer As FeatureLayer = map.GetLayersAsFlattenedList().OfType(Of FeatureLayer)().Where(Function(l) l.Name.Equals(layerName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault()&lt;/P&gt;&lt;P&gt;I hate VB!!&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for responding and for the tips on VB convertors.&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 14:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060423#M6591</guid>
      <dc:creator>BrianBulla</dc:creator>
      <dc:date>2021-05-21T14:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: GetLayersAsFlattenedList in VB</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060425#M6592</link>
      <description>&lt;P&gt;My pleasure.&lt;/P&gt;&lt;P&gt;I wouldn't hate on VB.&amp;nbsp; Just be happy it's not VB6 and you have to convert from VB6 to VB.NET.&lt;/P&gt;&lt;P&gt;Keep in mind that a lot of features currently in C# may not be available in VB.NET.&amp;nbsp; That means you may have even more verbose code than you normally have with VB.NET.&lt;/P&gt;&lt;P&gt;If there is any way you can move to C#, I would do it.&amp;nbsp; Make the case hard to the powers that be.&amp;nbsp; "Technical debt" would be my biggest argument.&amp;nbsp; There are far fewer VB.NET developers out there than C#.&amp;nbsp; It may be "cheaper" now to stay in VB.NET but it will be far more expensive down the line.&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 14:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060425#M6592</guid>
      <dc:creator>KrisCulin</dc:creator>
      <dc:date>2021-05-21T14:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: GetLayersAsFlattenedList in VB</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060526#M6595</link>
      <description>&lt;P&gt;Thanks Kris.&amp;nbsp; Yes, after a couple of hours of frustration I have abandoned VB and will for a full re-write in C#.&amp;nbsp; As you said, probably better to do it ASAP.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 17:33:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getlayersasflattenedlist-in-vb/m-p/1060526#M6595</guid>
      <dc:creator>BrianBulla</dc:creator>
      <dc:date>2021-05-21T17:33:38Z</dc:date>
    </item>
  </channel>
</rss>

