Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a C# program containing these lines:


Is there a quick way to type the 26 numbers? I'm using Visual Studio and Notepad++ for editors, but suggestions which use others editors are also welcome.

share|improve this question
You have written Console.Writeline("1)"; or Console.Writeline("1"); ? – kokbira Apr 23 '11 at 13:24
Have you considered writing a for loop? – Daniel Beck Apr 23 '11 at 13:50
@kokbira, thanks for catching my typo. – user12816 Apr 23 '11 at 16:41
Some text editors can do this for you. In Notepad++, I can't check right now (using Linux), but I'd be surprised if you can't. You can certainly record and playback macros - if you can't insert the numbers where you want them, you can insert them somewhere else then use a macro to cut/paste them into place. – Steve314 Apr 24 '11 at 8:07
up vote 3 down vote accepted

well, it depends what softwares you have.

with Excel/Calc, you can do that:

  1. In A1 put: Console.Writeline("
  2. In B1 put: 1
  3. In C1 put: ");
  4. In D1 put: =concatenate(A1;B1;C1)
  5. Select from A1 to D1 and copy and paste to te first 26 rows
  6. Select from D1 to D26, copy and paste cells to your code

with windows batch:

  1. open cmd (start>execute>cmd)
  2. write that in cmd and press enter: for /l %i in (1,1,26) do echo.Console.Writeline("%i");>>code.txt
  3. write that in cmd and then copy to your code: notepad code.txt
  4. write that in cmd to delete created .txt: del code.txt
share|improve this answer


vim myfile
# Navigate to where you want the code. (Use hjkl to move)
i  # Enter insert mode
esc # Enter command mode
qa # "start recording in register a"
# Duplicate the first line

You should now see something like;


Now place cursor at the 1 in the second line

Control a #increments the number
q #stop recording

Repeat the macro for as many lines as you want (in your case, 24 more times)

share|improve this answer
the vim way, hahahahah :) – kokbira Apr 25 '11 at 2:01

This C# code snippet will print out source code for you to copy and paste into your program:

for (int i = 1; i < 27; i++) {
    Console.Writeline("Console.Writeline(\"" + i.ToString() + "\");");

I really hope this is just a badly reduced sample of what you actually want to do.

share|improve this answer
I admit that the example is a bit goofy; I was just trying to illustrate the general problem. – user12816 Apr 23 '11 at 16:45
well, you can create a simple sequencegenerator.exe, giving what you want as parameters, like: sequencegenerator.exe p1=Console.Writeline(\" p2=[1-27] p3="); tp1=text tp2=counter tp3=text (think that you can use it in future) – kokbira Apr 29 '11 at 6:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .