Fastest function to generate Excel column letters in C#

前端 未结 21 1756
无人共我
无人共我 2020-11-29 02:30

What is the fastest c# function that takes and int and returns a string containing a letter or letters for use in an Excel function? For example, 1 returns \"A\", 26 return

21条回答
  •  爱一瞬间的悲伤
    2020-11-29 02:50

    Once your function has run, let it cache the results into a dictionary. So that, it won't have to do the calculation again.

    e.g. Convert(27) will check if 27 is mapped/stored in dictionary. If not, do the calculation and store "AA" against 27 in the dictionary.

提交回复
热议问题