locked
Xml Literals in C# RRS feed

  • Question

  • Hi,

      I dont know if someone already answered this question but, how come c#'s version of xlinq (, or c#3.0, or c# orcas, or whatever it's called now) does not include xml literals!  I cant imagine a reason not to include thins functionality beyond being too hard to do in c# or something like than.

    Thursday, May 11, 2006 9:29 PM

Answers

  • The C# design team has prioritized language changes like XML literals down quite a bit, believing that the XLinq constructors offer an equivalent degree of functionality. However, we are generally open on these sorts of things. If we get a lot of feedback from the community like yours we may reconsider our position.
    Friday, May 12, 2006 2:59 AM
  • The LINQ CTP includes a Visual Studio Add-in for this. It's pretty easy to use. Just copy some XML onto the clipboard. Then use "Paste XML as XElement" on the Edit menu and you'll get the XLinq code required to create that XML.

    Anders

    Sunday, May 14, 2006 5:17 AM

All replies

  • The C# design team has prioritized language changes like XML literals down quite a bit, believing that the XLinq constructors offer an equivalent degree of functionality. However, we are generally open on these sorts of things. If we get a lot of feedback from the community like yours we may reconsider our position.
    Friday, May 12, 2006 2:59 AM
  • There is also an XML-paster feature in the latest preview that you may want to try out.

    Thanks.

    Dinesh

    Friday, May 12, 2006 4:55 AM
  • Can you point me in the right direction to see this
    Friday, May 12, 2006 7:21 PM
  • The LINQ CTP includes a Visual Studio Add-in for this. It's pretty easy to use. Just copy some XML onto the clipboard. Then use "Paste XML as XElement" on the Edit menu and you'll get the XLinq code required to create that XML.

    Anders

    Sunday, May 14, 2006 5:17 AM
  • Hi,

    Where I can find this in VS.Net 2008?

    Kind Regards,

    Lennie De Villiers

    Wednesday, March 12, 2008 7:13 PM
  • In VS 2008, from the main menu: Help/Samples/LocalSamplesFolder/CSharpSamples/LinqSamples/PasteXmlAsLinq.

     

    Ion

     

    Wednesday, March 12, 2008 8:12 PM
  • That's very nice (honestly), but it doesn't handle something like this (from Beth Massey's dynamic Xaml example - http://code.msdn.microsoft.com/dynamicWPF/Release/ProjectReleases.aspx?ReleaseId=1201).  So, my vote is for adding XML Literals to C#.

    <

     

     

    Grid xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="Grid1">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="100*"/>
    <ColumnDefinition Width="200*"/>
    </Grid.ColumnDefinitions>
    <StackPanel Name="StackLabels" Margin="3">
    <%= From column In Me.TableSchema _ 
    Where column.IsPrimaryKey = 0 AndAlso column.DataType <> "timestamp" _ 
    Select <Label Height="28" Name=<%= column.ColumnName & "Label" %>
    HorizontalContentAlignment="Right">
    <%= column.ColumnName %>:</Label> %>
    </StackPanel>
    <StackPanel Grid.Column="1" Name="StackFields" Margin="3">
    <%= From column In Me.TableSchema _ 
    Where column.IsPrimaryKey = 0 AndAlso column.DataType <> "timestamp" _ 
    Select GetUIElement(column) %>
    </StackPanel>
    </Grid>
    Wednesday, October 7, 2009 10:40 PM
  • Count me in to vote for XML literal in C#.
    Why? As an x-VB developer, I do not want to go back to VB.net just for the sake of using XML Literal.

    Tuesday, January 5, 2010 9:19 PM
  • I second that jsWebDev...I was VERY surprised to learn that C# doesn't have that....that's  quite crazy if you ask me...PLEASE add it!!!
    Tuesday, February 23, 2010 3:02 PM
  • Another vote for embedded XML. It actually makes me want to use VB instead. Please hurry up and add it!!!!!
    DanWoerner
    Wednesday, March 17, 2010 3:08 PM
  • XML Literals are so nice to work with when creating dynamic html, which you do a lot of using Asp.net MVC.

    This is the main reason i don't want to switch my team from VB.Net to C#. I am sure we will get by, however XML Literals is a really needed feature in C#.

    So please add 1 vote for me, thanks.

    Thursday, April 29, 2010 3:25 PM
  • sry for bumping an old thread. 50 votes for me
    Thursday, January 13, 2011 5:08 PM
  • Hi,

     in this moment when we work with  the Xml file we switch in VB.NET

     

    So please add 6 vote for me.

    Wednesday, September 7, 2011 1:58 PM
  • after thinking about it I would add another 50 votes
    http://qweop.com
    • Edited by Pacerier Wednesday, September 7, 2011 2:11 PM
    Wednesday, September 7, 2011 2:11 PM