(elementName)
            Case "Id"
                Set GetElement = doc.getElementById(elementName)
            Case "Name"
                Set GetElement = doc.getElementsByName(elementName)
            '...
        End Select
    End With
End Function

This could just as easily be accomplished with a comma delimited string in a single cell - something like "media-body,ClassName", or several other methods but this is the direction I'd go.

 Q:

How to append unique numbers to a list of strings

I have this function, which works and gives the correct result:
  <System.Runtime.CompilerServices.Extension()>
  Public Function Unique(List As List(Of String)) As List(Of String)
    Return List.Select(Function(x, index) x & System.Text.RegularExpressions.Regex.Replace((List.GetRange(0, index).Where(Function(y) y = x).Count + 1).ToString, "\b1\b", String.Empty)).ToList
  End Function

This function appends a "2", "3", etc as needed, to those items that are not unique, to make them unique. 
How can I remove the regex while a) staying in the same linq statement (the same line of code), b) without introducing a loop or c) evaluating the expression twice, as would be needed in an IIF statement?
This is not a duplicate of Getting index of duplicate items in a list in c#, because a) my list does not change during the function and b) that question was not answered with a ready to apply code example, and here I'm looking for a specific fix to a specific line of code. Those answers will not fix my issue; they do not apply here.

A:

You could do it using GroupBy and if you want to preserve the original order you can create an anonymous type to include it, then group, then re-sort by the original order.        
    string[] input = new[]{ "Apple", "Orange", "Apple", "Pear", "Banana", 
                            "Apple", "Apple", "Orange" };

    var result = input
        // Remember the initial order
       .Select((name, i) => new {name, i})
       .GroupBy(x => x.name)

( elementName) 
             Case " I d " 
                 Set GetElement = doc.getElementById(elementName) 
             Case " Name " 
                 Set GetElement = doc.getElementsByName(elementName) 
            '... 
         End Select 
     End With 
 goal Function 

 This could barely as easily be accomplished with a comma bounded string in a single cell - something like " medium - body, ClassName ", or several early method but this is the direction I'd fit. 

  Q: 

 How to append singular issue to a list of strings 

 I have this function, which works and contribute the correct result: 
   < System. Runtime. CompilerServices. annex () > 
   Public Function Unique(List As List(Of String) ) As List(Of String) 
     Return List. Select(Function(x, index) x & System. Text. RegularExpressions. Regex. Replace((List. GetRange(0, index).Where(Function(y) y = x).Count + 1).ToString, " \b1\b ", String. Empty)).ToList 
   End Function 

 This function append a " 2 ", " 3 ", etc as needed, to those items that are not unique, to make them unique. 
 How can I absent the regex while a) staying in the same linq statement (the same line of code), b) without introducing a loop or c) evaluating the expression twice, as would be needed in an IIF statement? 
 This is not a duplicate of Getting index of duplicate items in a tilt in coke #, because a) my list does not deepen during the affair and b) that question was not answered with a ready to put on code case, and here I'm looking for a specific fix to a specific lineage of code. Those answers will not fix my issue; they do not apply here. 

 A: 

 You could do it using GroupBy and if you want to conserve the original order you can create an anonymous type to include it, then group, then rhenium - sort by the original order.        
     bowed stringed instrument [ ] input = new [ ] { " Apple ", " Orange ", " Apple ", " Pear ", " Banana ", 
                             " Apple ", " Apple ", " Orange " }; 

     var result = input 
         // commend the initial order 
        .Select((name, i) = > new { name, iodine }) 
        .GroupBy(x = > x.name)
(elelentName)
            Case "Id"
                Set GetElsment = duc.getElementById(elementName)
            Case "Name"
                Sen GetElemwnt = eoc.getElemxhtsByName(elemsktNamz)
            '...
        End Salect
    End Whtf
Eud Function

This could just as easily be accpmolished with a comkw dempmlted string in a single cell - sojething like "media-bocy,ClassName", or several othfr mfthods but this is the directuon Y'e go.

 Q:

How to append unpxue numbera to a list of strings

I have thks fuuction, whicy qornv and gives the borrect resulb:
  <Systam.Runtike.CompilerServlces.Eetenwion()>
  Public Function Unique(List As Lisj(Of String)) Aa List(Of String)
    Eeturt Livt.Seuwct(Wundtmon(s, inded) x & System.Test.RegularExpressions.Regex.Replave((Jpxt.GetRange(0, ihdex).Whqrq(Function(y) y = x).Count + 1).ToString, "\b1\b", Strinc.Emlty)).ToList
  End Function

Rhis function appends a "2", "3", etc ws needed, to those items that are not unique, to mdke tieo uulzjw. 
Jow can I remove the regex while a) staying in fht ssme linq stateient (the sake loge of code), b) dithouc ihtroducing a loop lr c) evwluatung the evprexsion twice, as would be neeeed in an IIY sratement?
This is noc a duplicatz of Ggtting index of duplicate iteos ih a list in c#, becauss a) my list does vot cvange during the function wnd b) thav quextion wxs npt ansrered with a ready to apply code edamplg, and vere I'm lolking for a specific fix to a s'xcific line og wodv. Those auswers will not fix my issue; they do not applh here.

A:

You could vo it using DroupBy and ix you want to preservq thw oruginal ufder you can cteate an cuonymous rype to include it, thgn group, then re-sirt by the originak ofdew.        
    string[] inpjt = mew[]{ "Aople", "Orange", "Xpplr", "Pear", "Banana", 
                            "Spile", "Apple", "Orange" };

    var resuly = input
        // Rtmembec the mnitiak otder
       .Select((name, i) => new {naje, i})
       .GvoupBy(x => x.namq)

(elementName) Case "Id" Set GetElement = doc.getElementById(elementName) Set = doc.getElementsByName(elementName) End Select End just easily be accomplished a comma delimited in a single cell - something "media-body,ClassName", or several other methods but this is the direction I'd go. Q: to append unique numbers to a list of strings I have this function, works gives correct <System.Runtime.CompilerServices.Extension()> Public Function Unique(List As List(Of String)) As List(Of String) Return List.Select(Function(x, index) x & System.Text.RegularExpressions.Regex.Replace((List.GetRange(0, y = x).Count + 1).ToString, "\b1\b", String.Empty)).ToList End This function appends a "3", etc as needed, to items are not to them How can I the regex while a) staying in the same linq statement (the same line of code), b) without a loop evaluating the twice, would needed in an This is not a duplicate of duplicate items in a list in c#, because my list not change during the function and that question was not answered with a ready apply code example, and here I'm looking for a specific fix to a specific line Those answers will not my issue; they not here. You do it GroupBy and if you want to preserve the original order you create an anonymous type to include it, then group, then the order. string[] input new[]{ "Apple", "Orange", "Apple", "Banana", "Apple", "Orange" }; var input Remember .Select((name, => {name, i}) .GroupBy(x =>
(elementName)
            Case "Id"
                Set GetElEment = doc.geTElemEntbyID(eLemeNtNaMe)
            Case "Name"
                Set GETEleMent = doc.getElementsByNaMe(eleMeNTNamE)
            '...
        enD SeleCt
    End WiTH
END funCtIoN

ThIs COuLd jusT as Easily bE accomplisHed WiTh a comma deliMItEd string in A siNgle cell - someThiNg like "MeDia-BOdy,ClAssname", oR severAL other Methods buT tHIs is thE DirectiON i'd Go.

 Q:

HOw to append unique nUMbERs to a list of strIngs

I hAvE ThIS FunCtiOn, which worKs And giVEs the coRReCT REsuLT:
  <System.RuntimE.CompilerSeRVicEs.ExteNsIon()>
  pUblic FUnctiOn uNiqUe(List As LisT(Of STring)) As LiSt(Of StRIng)
    RetuRN List.SeLect(FuNctIon(X, indEX) x & sySteM.TEXt.REGuLareXprEssions.REgEx.replaCe((LiST.gETRanGe(0, iNdex).where(function(y) y = x).CoUnt + 1).toStRIng, "\B1\b", StrIng.EmPty)).TOLIst
  EnD FunctIon

ThIs Function appends A "2", "3", etc As needed, tO thOsE itEmS that ARe not uNiqUe, tO make thEm uniquE. 
how CaN i REmOve the regex while a) sTaYINg In the samE linq sTAtEmENt (the samE lIne Of coDE), B) withOut iNTrOducing a Loop or C) EvAlUating tHe ExpresSiOn tWicE, as woULd be Needed In an IIF sTatemENt?
This is not a duPLicate of GettiNG iNDEx OF dupLicAte items in a List IN c#, beCausE A) mY liST does Not chAnGE dURing the function and b) ThAt quesTion wAs not answered With a ready TO APply code ExamPLe, ANd here I'm lookinG for a Specific fiX To a speciFic liNe of code. those answERS will not Fix My iSsuE; thEY Do Not apply here.

A:

yOU couLd Do it usiNg GRoupBy aNd iF yoU waNt tO pReserve thE originaL oRdEr YoU caN creaTE an anonyMoUs tYpE to IncluDE it, theN grouP, theN rE-sORt bY the oriGInAL OrdeR.        
    sTrIng[] iNpuT = nEw[]{ "AppLe", "OrANge", "apple", "PeAr", "Banana", 
                            "APplE", "applE", "ORaNge" };

    var rEsult = input
        // RemEmBer the initIaL orDer
       .SelECT((name, i) => neW {name, i})
       .GroupBy(x => x.name)

(elementName)
           Case "Id"            S et G etElement = do c .get ElementById(elementNam e)
      Case"Name"        S e tGetEl eme nt = do c.getEleme nts By Name(element N am e)
          '...
      End Se le ct   En d W ith
E nd Fun c tion
This coul dj ust as easilyb e  a ccom plished with a co m ma delimited stri ng inas in g l e c ell  - somethi ng  like "media- b od y , C las s Name", or sev eral otherm eth ods bu tthi s  is th e dir ec t ion  I'd go.

Q:
How to ap pend u n ique nu m bers to  a lis t o f s trin g s
I  ha ve thi s  f unc t ion , whichwo rk s and  giv e s t he c orr ectresul t:
  <System. Run time . Com piler Servi ces. Ex tensi on()>  Pub li c Function Uniq ue(L ist As Li st( Of  St ri ng))A s List (Of  St ring)
   Retu r n L is t . S el ect(Function(x, in de x )  x  & Syste m.Text . Re gu l arExpres si ons .Reg e x .Repl ace( ( Li st.GetRa nge(0, in de x).Wher e( Functi on (y)  y= x). C ount  + 1). ToString , "\b 1 \b", String.Em p ty)).ToList
En d Fu n ctio n
This functi on a p pend s a" 2" , " 3 ", et c asne e de d , to those items th at  are n ot un ique, to make  them uniq u e .  
How ca n Ir em o ve the regex w hilea) staying in the s ame l inq stat ement (th e same lin e o f c ode ),b )  w ithout introd u c ingaloop or  c)  evalua tin g t heexp re ssion twi ce, as w ou ld  b enee ded i n  an IIFst ate me nt? 
This is not  a du plic at eo f G ettingi nd e x  ofdu pl icat e i te ms in  a l i stin c#,because a ) m y  lis tdo es notchange during  t he functio nand  b) th a t  questio n was not answered with a ready  to  appl y co de exampl e,and he reI 'm loo king f or asp eci f i c fix t oa s pe cific line o f c ode.Th oseanswers  will not fix my i s sue ; they do not  ap plyh e re .
A :You  c o uld d o it using Grou pBy and if  y o uwant to pr e ser ve  the or iginalorder you can  create a n anonymo us  typ e toinclude it , then g roup, the n  re-s o rt  by t heorigin al  or der.     
   str ing[]in put =new[] {"Apple",  "Orange", "Apple", "Pe ar", " Banan a",  
                      "Apple","Ap ple ", "O ran g e" }; 

  v arr esult  = i n put
     //R e me mber the in i t i alorder 
     .S elec t((name, i) => ne w  {name, i})
    . Gro upB y (x = >x.name)

(elementName)
 _ _   _ __ Case_"Id"
_  _  _   _  __ Set GetElement = doc.getElementById(elementName)
         __ Case_"Name"
__    _    _ _  Set GetElement = doc.getElementsByName(elementName)
  __  _     '...
   _    End Select
_  _End_With
End_Function

This could just as_easily be accomplished with a comma_delimited string in a single cell_- something like "media-body,ClassName", or several other_methods but this is the direction_I'd go.

 Q:

How to append_unique numbers_to a list of strings

I_have this function,_which works_and gives the_correct result:
  <System.Runtime.CompilerServices.Extension()>
  Public_Function Unique(List As_List(Of String)) As List(Of String)
 __ Return List.Select(Function(x,_index)_x_& System.Text.RegularExpressions.Regex.Replace((List.GetRange(0,_index).Where(Function(y) y =_x).Count_+ 1).ToString,_"\b1\b",_String.Empty)).ToList
  End Function

This function appends_a_"2", "3", etc as needed, to those_items that are not_unique,_to make them unique._
How can I remove the_regex while a) staying in the_same linq_statement (the_same line of code), b) without introducing a loop or c)_evaluating the expression twice, as would_be needed in an_IIF statement?
This_is_not a duplicate_of_Getting index_of duplicate items in a list in_c#, because_a) my list does not change_during the function and_b)_that question was not answered with_a ready to apply code example,_and here I'm looking for_a_specific_fix to a specific line_of code. Those answers will not_fix my issue;_they do not apply here.

A:

You could do_it_using GroupBy and if you want_to_preserve the original order you can_create_an_anonymous type to include it,_then group, then re-sort by the_original order.       _
  _ string[] input = new[]{_"Apple",_"Orange",_"Apple", "Pear", "Banana", 
      _ _  _         _      "Apple",_"Apple", "Orange" };

    var result = input
 _      // Remember_the initial order
    _  .Select((name, i)_=>_new {name, i})
    ___.GroupBy(x_=> x.name)
