0

When I ask a question I probably also add code. I use a Mac for development but run also Windows in vmware.

Posting code this editor has a "Code Sample" tag. This works fine, but sometimes, like in my last question, the code is split up and some code is printed out like normal text.

Example: using return values from a c# .net made component build as com+

So what did I do wrong? I searched the FAQ but didn't find any info.

0

2 Answers 2

2

What messed up the code formatting in the linked question is the indenting. Indenting a line with 4 spaces causes it to be formatted as code. When a line is flush against the left margin, it's treated as regular text.

Clicking the "Code Sample" button attempts to indent each line of an entire block of text 4 spaces, but it doesn't always work when you copy and paste from your IDE. If you notice a formatting problem, go back and ensure that each line is properly padded. The "preview" pane at the bottom of the page can help you make sure that everything looks right. And remember, you can go back and edit your question or answer even after you've submitted it if you only notice the code formatting later.

2

I see in your post source that your first line of code, using System;, is indented, but the rest is not. Did you select all of the text in your code when you pressed the code sample button? If you press the button before pasting, you get this:

    enter code here

with "enter code here" selected. If you then immediately paste, your code will overwrite the default text and leave your first line indented with the rest unindented.

You must log in to answer this question.

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