﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Blog</title>
    <description>Blog</description>
    <link>http://www.willemdejong.net/Home/tabid/96/BlogId/1/language/en-US/Default.aspx</link>
    <language>en-US</language>
    <webMaster>willem@monack.net</webMaster>
    <pubDate>Sun, 05 Sep 2010 04:13:17 GMT</pubDate>
    <lastBuildDate>Sun, 05 Sep 2010 04:13:17 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.5.1.19887</generator>
    <item>
      <title>Grab content from webpage</title>
      <description>&lt;p&gt;&lt;strong&gt;For an application I am working on, I needed to integrate dynamic content from a webpage. Unfortunately the website doesn’t offer any kind of xml feed, so I needed to transform the xhtml from the webpage into a format for my application.&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;My first idea was to look at the xhtml as if it is xml, which could be a solution. Because I am convinced that there is always somebody else with the same problem or part of problem, I was searching the web for blog articles and forum posts for information about this.&lt;/strong&gt;&lt;/div&gt;&lt;a href=http://www.willemdejong.net/Home/tabid/96/EntryId/3/Grab-content-from-webpage.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://www.willemdejong.net/Home/tabid/96/EntryId/3/Grab-content-from-webpage.aspx</link>
      <comments>http://www.willemdejong.net/Home/tabid/96/EntryId/3/Grab-content-from-webpage.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.willemdejong.net/Home/tabid/96/EntryId/3/Grab-content-from-webpage.aspx</guid>
      <pubDate>Sun, 17 Jan 2010 15:20:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://www.willemdejong.net/DesktopModules/Blog/Trackback.aspx?id=3</trackback:ping>
    </item>
    <item>
      <title>Extend non-extendable objects</title>
      <description>&lt;p&gt;&lt;strong&gt;For a project I am currently working on I needed to convert a tab separated database file into a Datatable. The database file is a plain text file and the fields are tab separated, every record is a new line.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Just extend the string class, I thought, and add a function ToDataTable() which converts the string to a corresponding datatable. But then I found out that Microsoft decided to make the string class sealed. This means that you are not allowed to extend it.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;But what if you really want to extend it? Build a wrapper? That is a lot of work and not very maintainable. Then I found out you can actually extend a sealed class by putting “this” as a parameter.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Public static DataTable ToDataTable(this string s)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If you put a function like this somewhere in a (static) class you can use it like this:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;String TestString = “Test”;&lt;br /&gt;
DataTable Dt = TestString.ToDataTable();&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;With this you can, after reading out the database file, convert the text very easily to a DataTable en bind it to a Gridview.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Click on read more for the complete code to convert the tab separated string to a DataTable.&lt;/strong&gt;&lt;/p&gt;&lt;a href=http://www.willemdejong.net/Home/tabid/96/EntryId/1/Extend-non-extendable-objects.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://www.willemdejong.net/Home/tabid/96/EntryId/1/Extend-non-extendable-objects.aspx</link>
      <comments>http://www.willemdejong.net/Home/tabid/96/EntryId/1/Extend-non-extendable-objects.aspx#Comments</comments>
      <guid isPermaLink="true">http://www.willemdejong.net/Home/tabid/96/EntryId/1/Extend-non-extendable-objects.aspx</guid>
      <pubDate>Fri, 01 Jan 2010 21:10:00 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://www.willemdejong.net/DesktopModules/Blog/Trackback.aspx?id=1</trackback:ping>
    </item>
  </channel>
</rss>