Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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.

share|improve this question

migrated from Jan 7 '11 at 8:25

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

You must log in to answer this question.

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