What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Regarding this question, I made the work to translate both in VB.NET and C#, as the subject applies to both those languages. I try to do that as often as I can when it applies to touch the biggest audience, as both communities do not overlap as much as it would be possible. It would be nice to have a better presentation for this kind of case like in msdn, tab-based per language. See for example this page wich has both VB.NET and C# code (oh and the copy script would be a nice addition too :))

I can see it applied to other cases in questions outside of the .net stack, questions regarding oop, or c/c++ questions.

Example of mark-up (the -- could be anything available and practical):

--VB.NET

Imports System.Runtime.InteropServices

  <ComImport()>
  <Guid("8DA56996-A151-4136-B474-32784559F6DF")>
  Public Interface ISampleInterface
    Sub GetUserInput()
    ReadOnly Property UserInput As String


  ...


  End Interface

--C#

using System;
  using System.Runtime.InteropServices;

  namespace TypeEquivalenceInterface
  {
    [ComImport]
    [Guid("8DA56996-A151-4136-B474-32784559F6DF")]
    public interface ISampleInterface
    {
        void GetUserInput();
        string UserInput { get; }


  ...


    }
  }

would turn into :

enter image description here

share|improve this question
    
Just to clarify: you would like to place tabs above code samples? Could you provide an example of the Markdown syntax you envision to do this? –  Chris Frederick Jul 28 '11 at 18:04
    
@Chris : added an example of mark-up and result intended, thanks for the comment :) –  Matthieu Jul 28 '11 at 18:25
    
With regards to the question you've linked: please do not add/fix code in an OP's question. –  user7116 Jul 28 '11 at 18:47
    
@sixlettervariables : I can see your point regarding language specific questions, but some of them, especially in the .net stack, are advantaged by a translation for more answers possible (VB.NET -> C#). Pragmatically, I wouldn't translate a C# question, but I may add a VB.NET translation to the answer that I found useful, because I did the job to translate (auto-translate are not always working efficiently), and if I needed to do it, others may as well. –  Matthieu Jul 28 '11 at 19:02
    
@sixlettervariables: I don't think that he modified the original question. He provided VB.NET and C# implementations in his answer. –  Chris Frederick Jul 28 '11 at 19:03
    
@Chris : I did Chris. I felt it was making sense, and added visibility to the question, that was more .net, than vb.net specific. –  Matthieu Jul 28 '11 at 19:04
1  
Even if the question was tagged .net and they gave sample source in VB.Net, please do not edit the question to add equivalent code in any other language. You certainly can add an answer in one or more .Net languages. And @Chris: I rejected the edit I referred to. –  user7116 Jul 28 '11 at 19:06
    
Ah, okay. Carry on. :) –  Chris Frederick Jul 28 '11 at 19:10
    
@sixlettervariables: Sorry about that, I can see how it could become hard to moderate in some cases if you let that door open. I'll keep that kind of translation in answers, and my own questions. That still leaves usability for my feature :) –  Matthieu Jul 28 '11 at 19:45
1  
This could be useful in other SE sites too; for example, when answering a question about Drupal, I could need to report the code for two different versions of Drupal, and showing the code in tabs would help reading the answer. –  kiamlaluno Jul 28 '11 at 20:04

2 Answers 2

I think it's a neat idea and I like how the MSDN does it, but really I think the potential use-cases are few and far between, and to introduce extra syntax to accomodate them would be adding noise to the markdown help for little benefit. C#, VB, and any other .NET language could benefit, but usually the asker is looking for a specific solution in one of those languages, not "how would I do it in any .NET language?"

I'd challenge you to find more than a dozen questions currently in the system that would benefit from this. Or even to come up with a dozen hypothetical questions that would benefit from this which would be consisdered good fits for Stack Overflow. Otherwise, it seems to be significant extra effort for minimal payoff.

share|improve this answer

I believe that the beauty of SO is in its simplicity. I don't mean to discredit the idea. Ideas are good but I have few concerns with this particular feature.

  • SO is not a place for documentation. MSDN does that because they are supposed to provide examples for all the languages that they make and sell.

  • As @Daniel pointed out, users post questions with a particular language in mind. So, whoever is answering the question will most probably answer it specific to the language. If it is language X and the user wants it in language Y, now a days there are lots of tools that can do it for them.

  • Even if we go with tabs, which language would be selected by default to begin with C# or VB.NET. That's going to start whole another debate.

  • The markdown syntax might get complicated as well.

  • Having the ability to view both the code sections one after the other will help in comparing the differences (if that is ever used by programmers who work in both the languages, I believe that's a rare and endangered species). Yes, I have provided samples in C# and VB.NET languages while answering few SO questions. Personally, I prefer scrolling instead of clicking on the tabs because I work in both VB.NET and C#. Sometimes, I would like to see what the syntax differences are.

  • Regarding the copy link, I think it is easier to select and copy the code.

Let's keep it simple, please.

share|improve this answer

You must log in to answer this question.

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