Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This code</p> <pre><code>char[] resultTitle; resultTitle = (node.ChildNodes[i].Attributes ["ows_Title"].Value).ToArray(); string s = new string(resultTitle); Console.ReadLine(); </code></pre> <p>Takes a string value turns into a character array. <code>).ToArray()</code> and then immediately converts the character array back into a string.</p> <p>This is the same thing without the extra memory allocation</p> <pre><code>string s = node.ChildNodes[i].Attributes ["ows_Title"].Value; </code></pre> <hr> <p>If I were you however I would just use linq to xml. I'd also want to end up with a <code>List&lt;string&gt;</code> </p> <pre><code>XNamespace z = "#RowsetSchema"; List&lt;string&gt; list = (from row in xdoc.Descendants(z + "row") select (string)row.Attribute("ows_LinkTitle") ).ToList(); </code></pre> <p>Complete sample</p> <pre><code> static void Main(string[] args) { string xstring = @"&lt;xml xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'&gt; &lt;rs:data&gt; &lt;z:row ows_ID='360' ows_LinkTitle='GEI Survey data to Sharepoint' ows_Project_x0020_Priority='0' ows_AssignedTo='615;#Jeremy, Ron' ows_Status='In Progress' ows_Priority='(2) Normal' ows_DueDate='2012-04-27 00:00:00' ows_PercentComplete='0.700000000000000' ows_Modified='2012-04-30 10:44:15' ows_Alignment='TSS Delivery Mgmt' ows_SME='44;#Lewis, Clark' /&gt; &lt;z:row ows_ID='378' ows_LinkTitle='Create back end and environment to support User demographic reporting' ows_Project_x0020_Priority='0' ows_AssignedTo='615;#Sam, Johns' ows_Status='In Progress' ows_Priority='(2) Normal' ows_DueDate='2012-05-11 00:00:00' ows_PercentComplete='0.800000000000000' ows_Modified='2012-05-09 13:50:17' ows_Alignment='Team Internal' ows_SME='7;#CORP\sscer;#9;#CORP\vreer' /&gt; &lt;z:row ows_ID='249' ows_LinkTitle='Training Material to Muti Media' ows_AssignedTo='620;#Jenkins, Kristen' ows_Status='Not Started' ows_Priority='(2) Normal' ows_DueDate='2012-08-10 00:00:00' ows_PercentComplete='0' ows_Modified='2012-05-16 11:20:29' ows_Alignment='Diver Support' ows_SME='1;#CORP\vsswer;#7;#CORP\adder' /&gt; &lt;/rs:data&gt; &lt;/xml&gt;"; XDocument xdoc = XDocument.Parse(xstring); // there are other ways to construct your xdoc XNamespace z = "#RowsetSchema"; List&lt;string&gt; list = (from row in xdoc.Descendants(z + "row") select (string)row.Attribute("ows_LinkTitle") ).ToList(); foreach (var item in list) Console.WriteLine(item); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload