<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments for Guy Mahieu's Blog</title>
	<atom:link href="http://blog.guymahieu.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.guymahieu.com</link>
	<description>Agile OO Software Development and More</description>
	<pubDate>Mon, 06 Feb 2012 06:08:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on Deep reflection of properties: PropertyReflector by Federico Colombo</title>
		<link>http://blog.guymahieu.com/2006/07/11/deep-reflection-of-properties-propertyreflector/#comment-21462</link>
		<dc:creator>Federico Colombo</dc:creator>
		<pubDate>Mon, 17 Oct 2011 17:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=9#comment-21462</guid>
		<description>I've modified a little bit the code to allow indexed access to IList or IEnumerable properties.

Use example:
PropertyReflector pr = new PropertyReflector();
var anon = new { Colors = new Dictionary() { {100, Color.Red}, {200, Color.Blue} }, SelectedColor = 100};
object o1 = pr.GetValue(anon, "Colors[0].Key");
object o2 = pr.GetValue(anon, "Colors[1].Value");
object o3 = pr.GetValue(anon, "SelectedColor");


The Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;

// Original from: http://blog.guymahieu.com/wp-content/uploads/2007/02/propertyreflector.cs
// Modified to allow IList &#38; IEnumerable for indexed access (ie: MyCollection[1].Name)

namespace Core
{
    public class PropertyReflector
    {
        private const char PropertyNameSeparator = '.';

        private static readonly object[] NoParams = new object[0];
        private static readonly Type[] NoTypeParams = new Type[0];
        private static readonly Regex RegExIndex = new Regex(@"\[(?'index'\d+)\]");

        private IDictionary propertyCache = new Dictionary();
        private IDictionary constructorCache = new Dictionary();

        public Type GetType(Type targetType, string propertyName)
        {
            if (propertyName.IndexOf(PropertyNameSeparator) &#62; -1)
            {
                string[] propertyList = propertyName.Split(PropertyNameSeparator);
                for (int i = 0; i  -1)
            {
                string[] propertyList = propertyName.Split(PropertyNameSeparator);
                for (int i = 0; i  -1)
            {
                object originalTarget = target;
                string[] propertyList = propertyName.Split(PropertyNameSeparator);
                for (int i = 0; i &#60; propertyList.Length - 1; i++)
                {
                    propertyName = propertyList[i];
                    target = GetValueImpl(target, propertyName);
                    if (target == null)
                    {
                        string currentFullPropertyNameString = GetPropertyNameString(propertyList, i);
                        target = Construct(GetType(originalTarget.GetType(), currentFullPropertyNameString));
                        SetValue(originalTarget, currentFullPropertyNameString, target);
                    }
                }
                propertyName = propertyList[propertyList.Length - 1];
            }
            SetValueImpl(target, propertyName, value);
        }

        private static string GetPropertyNameString(string[] propertyList, int level)
        {
            StringBuilder currentFullPropertyName = new StringBuilder();
            for (int j = 0; j  0)
                {
                    currentFullPropertyName.Append(PropertyNameSeparator);
                }
                currentFullPropertyName.Append(propertyList[j]);
            }
            return currentFullPropertyName.ToString();
        }

        private Type GetTypeImpl(Type targetType, string propertyName)
        {
            return GetPropertyInfo(targetType, propertyName).PropertyType;
        }

        private object GetValueImpl(object target, string propertyName)
        {
            Match match = RegExIndex.Match(propertyName);
            int index = -1;
            if (match.Success)
            {
                // We have an index, get it and drop the index part "[i]" to get the List property
                index = int.Parse(match.Groups["index"].Value);
                propertyName = propertyName.Replace(match.Value, string.Empty);
            }
            PropertyInfo propInfo = GetPropertyInfo(target.GetType(), propertyName);
            if (index &#62;= 0 &#38;&#38; typeof(IEnumerable).IsAssignableFrom(propInfo.PropertyType))
            {
                return GetValueForIndexedItem(target, propInfo, index);
            }
            return propInfo.GetValue(target, NoParams);
        }

        private object GetValueForIndexedItem(object target, PropertyInfo propInfo, int index)
        {
            if (typeof(IList).IsAssignableFrom(propInfo.PropertyType))
            {
                return ((IList)propInfo.GetValue(target, NoParams))[index];
            }
            else if (typeof(IEnumerable).IsAssignableFrom(propInfo.PropertyType))
            {
                int i = 0;
                foreach (object o in ((IEnumerable)propInfo.GetValue(target, NoParams)))
                {
                    if (index == i)
                    {
                        return o;
                    }
                    i++;
                }
                throw new IndexOutOfRangeException(string.Format("Property '{0}' index '{1}' out of range", propInfo.Name, index));
            }
            else
            {
                throw new ArgumentException(string.Format("Property '{0}' must implement IList or IEnumerable in order to access an indexed value", propInfo.Name));
            }
        }

        private void SetValueImpl(object target, string propertyName, object value)
        {
            GetPropertyInfo(target.GetType(), propertyName).SetValue(target, value, NoParams);
        }

        private PropertyInfo GetPropertyInfo(Type type, string propertyName)
        {
            PropertyInfoCache propertyInfoCache = GetPropertyInfoCache(type);
            if (!propertyInfoCache.ContainsKey(propertyName))
            {
                PropertyInfo propertyInfo = GetBestMatchingProperty(propertyName, type);
                if (propertyInfo == null)
                {
                    throw new ArgumentException(string.Format("Unable to find public property named {0} on type {1}", propertyName, type.FullName), propertyName);

                }
                propertyInfoCache.Add(propertyName, propertyInfo);
            }
            return propertyInfoCache[propertyName];
        }

        private static PropertyInfo GetBestMatchingProperty(string propertyName, Type type)
        {
            PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Public &#124; BindingFlags.Instance &#124; BindingFlags.FlattenHierarchy);

            PropertyInfo bestMatch = null;
            int bestMatchDistance = int.MaxValue;
            for (int i = 0; i  0 &#38;&#38; distance &#60; bestMatchDistance)
                    {
                        bestMatch = info;
                        bestMatchDistance = distance;
                    }
                }
            }
            return bestMatch;
        }

        private static int CalculateDistance(Type targetObjectType, Type baseType)
        {
            if (!baseType.IsInterface)
            {
                Type currType = targetObjectType;
                int level = 0;
                while (currType != null)
                {
                    if (baseType == currType)
                    {
                        return level;
                    }
                    currType = currType.BaseType;
                    level++;
                }
            }
            return -1;
        }

        private PropertyInfoCache GetPropertyInfoCache(Type type)
        {
            if (!propertyCache.ContainsKey(type))
            {
                lock (this)
                {
                    if (!propertyCache.ContainsKey(type))
                    {
                        propertyCache.Add(type, new PropertyInfoCache());
                    }
                }
            }
            return propertyCache[type];
        }

        private object Construct(Type type)
        {
            if (!constructorCache.ContainsKey(type))
            {
                lock (this)
                {
                    if (!constructorCache.ContainsKey(type))
                    {
                        ConstructorInfo constructorInfo = type.GetConstructor(NoTypeParams);
                        if (constructorInfo == null)
                        {
                            throw new Exception(string.Format("Unable to construct instance, no parameterless constructor found in type {0}", type.FullName));

                        }
                        constructorCache.Add(type, constructorInfo);
                    }
                }
            }
            return constructorCache[type].Invoke(NoParams);
        }
    }

    internal class PropertyInfoCache
    {
        private IDictionary propertyInfoCache;

        public PropertyInfoCache()
        {
            propertyInfoCache = new Dictionary();
        }

        public bool ContainsKey(string key)
        {
            return propertyInfoCache.ContainsKey(key);
        }

        public void Add(string key, PropertyInfo value)
        {
            propertyInfoCache.Add(key, value);
        }

        public PropertyInfo this[string key]
        {
            get { return propertyInfoCache[key]; }
            set { propertyInfoCache[key] = value; }
        }
    }
}


Hope it helps.

Federico D. Colombo</description>
		<content:encoded><![CDATA[<p>I&#8217;ve modified a little bit the code to allow indexed access to IList or IEnumerable properties.</p>
<p>Use example:<br />
PropertyReflector pr = new PropertyReflector();<br />
var anon = new { Colors = new Dictionary() { {100, Color.Red}, {200, Color.Blue} }, SelectedColor = 100};<br />
object o1 = pr.GetValue(anon, &#8220;Colors[0].Key&#8221;);<br />
object o2 = pr.GetValue(anon, &#8220;Colors[1].Value&#8221;);<br />
object o3 = pr.GetValue(anon, &#8220;SelectedColor&#8221;);</p>
<p>The Code:<br />
using System;<br />
using System.Collections;<br />
using System.Collections.Generic;<br />
using System.Reflection;<br />
using System.Text;<br />
using System.Text.RegularExpressions;</p>
<p>// Original from: <a href="http://blog.guymahieu.com/wp-content/uploads/2007/02/propertyreflector.cs" rel="nofollow">http://blog.guymahieu.com/wp-content/uploads/2007/02/propertyreflector.cs</a><br />
// Modified to allow IList &amp; IEnumerable for indexed access (ie: MyCollection[1].Name)</p>
<p>namespace Core<br />
{<br />
    public class PropertyReflector<br />
    {<br />
        private const char PropertyNameSeparator = &#8216;.&#8217;;</p>
<p>        private static readonly object[] NoParams = new object[0];<br />
        private static readonly Type[] NoTypeParams = new Type[0];<br />
        private static readonly Regex RegExIndex = new Regex(@&#8221;\[(?'index'\d+)\]&#8220;);</p>
<p>        private IDictionary propertyCache = new Dictionary();<br />
        private IDictionary constructorCache = new Dictionary();</p>
<p>        public Type GetType(Type targetType, string propertyName)<br />
        {<br />
            if (propertyName.IndexOf(PropertyNameSeparator) &gt; -1)<br />
            {<br />
                string[] propertyList = propertyName.Split(PropertyNameSeparator);<br />
                for (int i = 0; i  -1)<br />
            {<br />
                string[] propertyList = propertyName.Split(PropertyNameSeparator);<br />
                for (int i = 0; i  -1)<br />
            {<br />
                object originalTarget = target;<br />
                string[] propertyList = propertyName.Split(PropertyNameSeparator);<br />
                for (int i = 0; i &lt; propertyList.Length - 1; i++)<br />
                {<br />
                    propertyName = propertyList[i];<br />
                    target = GetValueImpl(target, propertyName);<br />
                    if (target == null)<br />
                    {<br />
                        string currentFullPropertyNameString = GetPropertyNameString(propertyList, i);<br />
                        target = Construct(GetType(originalTarget.GetType(), currentFullPropertyNameString));<br />
                        SetValue(originalTarget, currentFullPropertyNameString, target);<br />
                    }<br />
                }<br />
                propertyName = propertyList[propertyList.Length - 1];<br />
            }<br />
            SetValueImpl(target, propertyName, value);<br />
        }</p>
<p>        private static string GetPropertyNameString(string[] propertyList, int level)<br />
        {<br />
            StringBuilder currentFullPropertyName = new StringBuilder();<br />
            for (int j = 0; j  0)<br />
                {<br />
                    currentFullPropertyName.Append(PropertyNameSeparator);<br />
                }<br />
                currentFullPropertyName.Append(propertyList[j]);<br />
            }<br />
            return currentFullPropertyName.ToString();<br />
        }</p>
<p>        private Type GetTypeImpl(Type targetType, string propertyName)<br />
        {<br />
            return GetPropertyInfo(targetType, propertyName).PropertyType;<br />
        }</p>
<p>        private object GetValueImpl(object target, string propertyName)<br />
        {<br />
            Match match = RegExIndex.Match(propertyName);<br />
            int index = -1;<br />
            if (match.Success)<br />
            {<br />
                // We have an index, get it and drop the index part &#8220;[i]&#8221; to get the List property<br />
                index = int.Parse(match.Groups["index"].Value);<br />
                propertyName = propertyName.Replace(match.Value, string.Empty);<br />
            }<br />
            PropertyInfo propInfo = GetPropertyInfo(target.GetType(), propertyName);<br />
            if (index &gt;= 0 &amp;&amp; typeof(IEnumerable).IsAssignableFrom(propInfo.PropertyType))<br />
            {<br />
                return GetValueForIndexedItem(target, propInfo, index);<br />
            }<br />
            return propInfo.GetValue(target, NoParams);<br />
        }</p>
<p>        private object GetValueForIndexedItem(object target, PropertyInfo propInfo, int index)<br />
        {<br />
            if (typeof(IList).IsAssignableFrom(propInfo.PropertyType))<br />
            {<br />
                return ((IList)propInfo.GetValue(target, NoParams))[index];<br />
            }<br />
            else if (typeof(IEnumerable).IsAssignableFrom(propInfo.PropertyType))<br />
            {<br />
                int i = 0;<br />
                foreach (object o in ((IEnumerable)propInfo.GetValue(target, NoParams)))<br />
                {<br />
                    if (index == i)<br />
                    {<br />
                        return o;<br />
                    }<br />
                    i++;<br />
                }<br />
                throw new IndexOutOfRangeException(string.Format(&#8221;Property &#8216;{0}&#8217; index &#8216;{1}&#8217; out of range&#8221;, propInfo.Name, index));<br />
            }<br />
            else<br />
            {<br />
                throw new ArgumentException(string.Format(&#8221;Property &#8216;{0}&#8217; must implement IList or IEnumerable in order to access an indexed value&#8221;, propInfo.Name));<br />
            }<br />
        }</p>
<p>        private void SetValueImpl(object target, string propertyName, object value)<br />
        {<br />
            GetPropertyInfo(target.GetType(), propertyName).SetValue(target, value, NoParams);<br />
        }</p>
<p>        private PropertyInfo GetPropertyInfo(Type type, string propertyName)<br />
        {<br />
            PropertyInfoCache propertyInfoCache = GetPropertyInfoCache(type);<br />
            if (!propertyInfoCache.ContainsKey(propertyName))<br />
            {<br />
                PropertyInfo propertyInfo = GetBestMatchingProperty(propertyName, type);<br />
                if (propertyInfo == null)<br />
                {<br />
                    throw new ArgumentException(string.Format(&#8221;Unable to find public property named {0} on type {1}&#8221;, propertyName, type.FullName), propertyName);</p>
<p>                }<br />
                propertyInfoCache.Add(propertyName, propertyInfo);<br />
            }<br />
            return propertyInfoCache[propertyName];<br />
        }</p>
<p>        private static PropertyInfo GetBestMatchingProperty(string propertyName, Type type)<br />
        {<br />
            PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);</p>
<p>            PropertyInfo bestMatch = null;<br />
            int bestMatchDistance = int.MaxValue;<br />
            for (int i = 0; i  0 &amp;&amp; distance &lt; bestMatchDistance)<br />
                    {<br />
                        bestMatch = info;<br />
                        bestMatchDistance = distance;<br />
                    }<br />
                }<br />
            }<br />
            return bestMatch;<br />
        }</p>
<p>        private static int CalculateDistance(Type targetObjectType, Type baseType)<br />
        {<br />
            if (!baseType.IsInterface)<br />
            {<br />
                Type currType = targetObjectType;<br />
                int level = 0;<br />
                while (currType != null)<br />
                {<br />
                    if (baseType == currType)<br />
                    {<br />
                        return level;<br />
                    }<br />
                    currType = currType.BaseType;<br />
                    level++;<br />
                }<br />
            }<br />
            return -1;<br />
        }</p>
<p>        private PropertyInfoCache GetPropertyInfoCache(Type type)<br />
        {<br />
            if (!propertyCache.ContainsKey(type))<br />
            {<br />
                lock (this)<br />
                {<br />
                    if (!propertyCache.ContainsKey(type))<br />
                    {<br />
                        propertyCache.Add(type, new PropertyInfoCache());<br />
                    }<br />
                }<br />
            }<br />
            return propertyCache[type];<br />
        }</p>
<p>        private object Construct(Type type)<br />
        {<br />
            if (!constructorCache.ContainsKey(type))<br />
            {<br />
                lock (this)<br />
                {<br />
                    if (!constructorCache.ContainsKey(type))<br />
                    {<br />
                        ConstructorInfo constructorInfo = type.GetConstructor(NoTypeParams);<br />
                        if (constructorInfo == null)<br />
                        {<br />
                            throw new Exception(string.Format(&#8221;Unable to construct instance, no parameterless constructor found in type {0}&#8221;, type.FullName));</p>
<p>                        }<br />
                        constructorCache.Add(type, constructorInfo);<br />
                    }<br />
                }<br />
            }<br />
            return constructorCache[type].Invoke(NoParams);<br />
        }<br />
    }</p>
<p>    internal class PropertyInfoCache<br />
    {<br />
        private IDictionary propertyInfoCache;</p>
<p>        public PropertyInfoCache()<br />
        {<br />
            propertyInfoCache = new Dictionary();<br />
        }</p>
<p>        public bool ContainsKey(string key)<br />
        {<br />
            return propertyInfoCache.ContainsKey(key);<br />
        }</p>
<p>        public void Add(string key, PropertyInfo value)<br />
        {<br />
            propertyInfoCache.Add(key, value);<br />
        }</p>
<p>        public PropertyInfo this[string key]<br />
        {<br />
            get { return propertyInfoCache[key]; }<br />
            set { propertyInfoCache[key] = value; }<br />
        }<br />
    }<br />
}</p>
<p>Hope it helps.</p>
<p>Federico D. Colombo</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting the svn HEAD revision number from a windows batch file by Sergiy</title>
		<link>http://blog.guymahieu.com/2008/06/09/getting-the-svn-head-revision-number-from-a-windows-batch-file/#comment-21123</link>
		<dc:creator>Sergiy</dc:creator>
		<pubDate>Mon, 19 Sep 2011 19:58:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/2008/06/09/getting-the-svn-head-revision-number-from-a-windows-batch-file/#comment-21123</guid>
		<description>This info is also returned by update, in form "At revision 181.", so next line will update your working copy and put revision number into Revision variable as well:

for /f "tokens=3 delims=. " %%i in ('svn update') do set Revision=%%i</description>
		<content:encoded><![CDATA[<p>This info is also returned by update, in form &#8220;At revision 181.&#8221;, so next line will update your working copy and put revision number into Revision variable as well:</p>
<p>for /f &#8220;tokens=3 delims=. &#8221; %%i in (&#8217;svn update&#8217;) do set Revision=%%i</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on System.Delegate is not a delegate type&#8230; by xxjthxx</title>
		<link>http://blog.guymahieu.com/2006/11/15/systemdelegate-is-not-a-delegate-type/#comment-20528</link>
		<dc:creator>xxjthxx</dc:creator>
		<pubDate>Fri, 12 Aug 2011 10:35:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=32#comment-20528</guid>
		<description>Thanks! Nice one!</description>
		<content:encoded><![CDATA[<p>Thanks! Nice one!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting the svn HEAD revision number from a windows batch file by Ian</title>
		<link>http://blog.guymahieu.com/2008/06/09/getting-the-svn-head-revision-number-from-a-windows-batch-file/#comment-19857</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Thu, 16 Jun 2011 16:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/2008/06/09/getting-the-svn-head-revision-number-from-a-windows-batch-file/#comment-19857</guid>
		<description>svnversion ain't the same thing!
You could make it a bit more future proof by not expecting a certain line to contain the data- I keep a log of the last changed revision when releasing stuff using:


FOR /F "delims=: tokens=1,2 " %%G IN ('svn info --revision HEAD') DO ^
IF "%%G"=="Last Changed Rev" echo %%H</description>
		<content:encoded><![CDATA[<p>svnversion ain&#8217;t the same thing!<br />
You could make it a bit more future proof by not expecting a certain line to contain the data- I keep a log of the last changed revision when releasing stuff using:</p>
<p>FOR /F &#8220;delims=: tokens=1,2 &#8221; %%G IN (&#8217;svn info &#8211;revision HEAD&#8217;) DO ^<br />
IF &#8220;%%G&#8221;==&#8221;Last Changed Rev&#8221; echo %%H</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Deep reflection of properties: PropertyReflector by JN</title>
		<link>http://blog.guymahieu.com/2006/07/11/deep-reflection-of-properties-propertyreflector/#comment-19528</link>
		<dc:creator>JN</dc:creator>
		<pubDate>Fri, 29 Apr 2011 13:33:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=9#comment-19528</guid>
		<description>Hi Adolfo,

Do you have complete source available somewhere? I have trouble getting all code snippets glued together.

Thanks,
JN</description>
		<content:encoded><![CDATA[<p>Hi Adolfo,</p>
<p>Do you have complete source available somewhere? I have trouble getting all code snippets glued together.</p>
<p>Thanks,<br />
JN</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on System.Delegate is not a delegate type&#8230; by ClaudeNegm</title>
		<link>http://blog.guymahieu.com/2006/11/15/systemdelegate-is-not-a-delegate-type/#comment-19417</link>
		<dc:creator>ClaudeNegm</dc:creator>
		<pubDate>Sat, 16 Apr 2011 20:37:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=32#comment-19417</guid>
		<description>Ya it's stupid, I really hate the idea, doesn't really make sense to me xD
Anyways, I love annonymous methods, I don't like having methods everywere not knowing what to do with them.
However, what I really can't imagine, is that Microsoft pretends that a Delegate isn't a delegate.
Multitasking is really irritating coming to Invoke functions in forms though..

The code I posted earlier may help.
You can use something else like:

delegate void test();
private void Invoke ( test x )
{
this.Invoke(new MethodInvoker(x));
}

What is weird is that I can write the code above and can't write:
private void Invoke ( delegate() x )
{
this.Invoke(new MethodInvoker(x));
}
:D</description>
		<content:encoded><![CDATA[<p>Ya it&#8217;s stupid, I really hate the idea, doesn&#8217;t really make sense to me xD<br />
Anyways, I love annonymous methods, I don&#8217;t like having methods everywere not knowing what to do with them.<br />
However, what I really can&#8217;t imagine, is that Microsoft pretends that a Delegate isn&#8217;t a delegate.<br />
Multitasking is really irritating coming to Invoke functions in forms though..</p>
<p>The code I posted earlier may help.<br />
You can use something else like:</p>
<p>delegate void test();<br />
private void Invoke ( test x )<br />
{<br />
this.Invoke(new MethodInvoker(x));<br />
}</p>
<p>What is weird is that I can write the code above and can&#8217;t write:<br />
private void Invoke ( delegate() x )<br />
{<br />
this.Invoke(new MethodInvoker(x));<br />
}<br />
:D</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on System.Delegate is not a delegate type&#8230; by Jason Shuler</title>
		<link>http://blog.guymahieu.com/2006/11/15/systemdelegate-is-not-a-delegate-type/#comment-19396</link>
		<dc:creator>Jason Shuler</dc:creator>
		<pubDate>Thu, 14 Apr 2011 05:18:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=32#comment-19396</guid>
		<description>Thank you!

i really think it is stupid that updating the GUI from an async event requires the event handler, a call to begin invoke, a delegate handler, and a function the delegate is for...

Too many steps if you ask me -- I had known about the easy way to do this in silverlight, thanks for showing how to do it in Forms!</description>
		<content:encoded><![CDATA[<p>Thank you!</p>
<p>i really think it is stupid that updating the GUI from an async event requires the event handler, a call to begin invoke, a delegate handler, and a function the delegate is for&#8230;</p>
<p>Too many steps if you ask me &#8212; I had known about the easy way to do this in silverlight, thanks for showing how to do it in Forms!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on System.Delegate is not a delegate type&#8230; by ClaudeNegm</title>
		<link>http://blog.guymahieu.com/2006/11/15/systemdelegate-is-not-a-delegate-type/#comment-19333</link>
		<dc:creator>ClaudeNegm</dc:creator>
		<pubDate>Thu, 07 Apr 2011 08:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=32#comment-19333</guid>
		<description>hey!
The best thing I could come with this case was by adding a new void function which does invoke the annonymous delegate for me instead for casting each time like you did.

private void Invoke ( Action anndel )
{
this.Invoke(new MethodInvoker(anndel));
}
 
void main()
{
Invoke(delegate { this.Text = "x"; txtbox.Text = "y"; });
}

Hope it helps! :D</description>
		<content:encoded><![CDATA[<p>hey!<br />
The best thing I could come with this case was by adding a new void function which does invoke the annonymous delegate for me instead for casting each time like you did.</p>
<p>private void Invoke ( Action anndel )<br />
{<br />
this.Invoke(new MethodInvoker(anndel));<br />
}</p>
<p>void main()<br />
{<br />
Invoke(delegate { this.Text = &#8220;x&#8221;; txtbox.Text = &#8220;y&#8221;; });<br />
}</p>
<p>Hope it helps! :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Deep reflection of properties: PropertyReflector by Property in Vietnam</title>
		<link>http://blog.guymahieu.com/2006/07/11/deep-reflection-of-properties-propertyreflector/#comment-16781</link>
		<dc:creator>Property in Vietnam</dc:creator>
		<pubDate>Mon, 12 Jul 2010 07:05:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=9#comment-16781</guid>
		<description>Thanks for sharing these tips. It is very helpful for us.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing these tips. It is very helpful for us.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Deep reflection of properties: PropertyReflector by Adolfo</title>
		<link>http://blog.guymahieu.com/2006/07/11/deep-reflection-of-properties-propertyreflector/#comment-16773</link>
		<dc:creator>Adolfo</dc:creator>
		<pubDate>Fri, 09 Jul 2010 20:51:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.guymahieu.com/?p=9#comment-16773</guid>
		<description>Hi Guy,

The modified version of GetValue method I just posted got chopped off it should be:
 public object GetValue(object target, string propertyName)
        {
            if (propertyName.IndexOf(PropertyNameSeparator) &#62; -1)
            {
                int index = -1;
                string[] propertyList = propertyName.Split(PropertyNameSeparator);
                for (int i = 0; i = 0)
                    {
                        var List = (IList) target;
                        if (index &#60; List.Count)
                        {
                            target = List[index];
                        }
                    }
                    if (target == null)
                    {
                        return null;
                    }
                }
                return target;
            }
            else
            {
                return GetValueImpl(target, propertyName);
            }
        }
Regards,
Adolfo</description>
		<content:encoded><![CDATA[<p>Hi Guy,</p>
<p>The modified version of GetValue method I just posted got chopped off it should be:<br />
 public object GetValue(object target, string propertyName)<br />
        {<br />
            if (propertyName.IndexOf(PropertyNameSeparator) &gt; -1)<br />
            {<br />
                int index = -1;<br />
                string[] propertyList = propertyName.Split(PropertyNameSeparator);<br />
                for (int i = 0; i = 0)<br />
                    {<br />
                        var List = (IList) target;<br />
                        if (index &lt; List.Count)<br />
                        {<br />
                            target = List[index];<br />
                        }<br />
                    }<br />
                    if (target == null)<br />
                    {<br />
                        return null;<br />
                    }<br />
                }<br />
                return target;<br />
            }<br />
            else<br />
            {<br />
                return GetValueImpl(target, propertyName);<br />
            }<br />
        }<br />
Regards,<br />
Adolfo</p>
]]></content:encoded>
	</item>
</channel>
</rss>

