<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Wed, 10 Jun 2026 11:22:20 +0000</lastBuildDate>
    <item>
      <title>(Visual Basic) Reflection extension method to copy properties from one object to another object. - s0lidmetal</title>
      <link>https://snipplr.com/view/36094/reflection-extension-method-to-copy-properties-from-one-object-to-another-object</link>
      <description>&lt;p&gt;This copies all property values from Class A to Class B. Useful if you have many unrelated classes that share similar properties and you are constantly writing code like:&#13;
&#13;
    shirt.Color = pants.Color&#13;
    shirt.Pattern = pants.Pattern&#13;
    shirt.Style = pants.Style&#13;
&#13;
Could change to:&#13;
&#13;
    pants.CopyPropertiesTo(shirt)&lt;/p&gt;</description>
      <pubDate>Thu, 24 Jun 2010 05:12:30 UTC</pubDate>
      <guid>https://snipplr.com/view/36094/reflection-extension-method-to-copy-properties-from-one-object-to-another-object</guid>
    </item>
    <item>
      <title>(Visual Basic) Reflection extension method to bind DataRow values to object properties. - s0lidmetal</title>
      <link>https://snipplr.com/view/36093/reflection-extension-method-to-bind-datarow-values-to-object-properties</link>
      <description>&lt;p&gt;This will populate object properties with values from a DataRow. The DataTable column names must match the property names and types of the target class.&#13;
&#13;
Example:&#13;
&#13;
    DataTable dt = new DataTable();&#13;
    dt.Columns.Add("TestString", typeof(string));&#13;
    dt.Columns.Add("TestBool", typeof(bool));&#13;
    dt.Columns.Add("TestInt", typeof(int));&#13;
    dt.Columns.Add("TestDouble", typeof(double));&#13;
    dt.Columns.Add("TestDecimal", typeof(decimal));&#13;
    dt.Columns.Add("TestFloat", typeof(string));&#13;
&#13;
    DataRow dr = dt.NewRow();&#13;
    dr["TestString"] = "Hello";&#13;
    dr["TestBool"] = false;&#13;
    dr["TestInt"] = DBNull.Value;&#13;
    dr["TestDouble"] =4.56;&#13;
    dr["TestDecimal"] = 7.89m;&#13;
    dr["TestFloat"] = "3.14f";&#13;
    dt.Rows.Add(dr);&#13;
&#13;
    TestClass tc = new TestClass();&#13;
    dr.AssignObjectValue(tc);&#13;
            &#13;
    class TestClass&#13;
    {&#13;
        public string TestString { get; set; }&#13;
        public bool? TestBool { get; set; }&#13;
        public int? TestInt { get; set; }&#13;
        public double TestDouble { get; set; }&#13;
        public decimal TestDecimal { get; set; }&#13;
        public float TestFloat { get; set; }&#13;
    }&lt;/p&gt;</description>
      <pubDate>Thu, 24 Jun 2010 05:04:11 UTC</pubDate>
      <guid>https://snipplr.com/view/36093/reflection-extension-method-to-bind-datarow-values-to-object-properties</guid>
    </item>
  </channel>
</rss>
