<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Dynamic Work Item Rss Feed</title><link>http://www.codeplex.com/WorkItem/List.aspx?ProjectName=Dynamic</link><description>Dynamic Work Item Rss Description</description><item><title>COMMENTED FEATURE: Allow sorting on object graph public properties</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=6443</link><description>It would be helpful if there were a simple way to sort objects deeper in the object graph via their public properties.&lt;br /&gt;&lt;br /&gt;An Example Scenario&amp;#58;&lt;br /&gt;Parent object has children objects with property of Firstname&lt;br /&gt;The ability to specify an orderby &amp;#40;or alternative means&amp;#41; to sort by Parent.Child.Firstname &amp;#40;where Firstname is a public property of Child object&amp;#41;&lt;br /&gt;Comments: ** Comment from web user: ngruson ** &lt;p&gt;I made some changes to the code to support this requirement and it works for me. You can get it at http&amp;#58;&amp;#47;&amp;#47;nils-gruson.blogspot.com&amp;#47;. Marc, can you take a look at this&amp;#63;&lt;/p&gt;&lt;p&gt;Greets,&lt;br /&gt;Nils Gruson&lt;/p&gt;</description><author>ngruson</author><pubDate>Thu, 29 Nov 2007 13:02:03 GMT</pubDate><guid isPermaLink="false">COMMENTED FEATURE: Allow sorting on object graph public properties 20071129010203P</guid></item><item><title>CREATED ISSUE: Add support for automatic generation of Equals method and GetHashCode method</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=14134</link><description>Per the best-practice documented &amp;#91;url&amp;#93;http&amp;#58;&amp;#47;&amp;#47;musingmarc.blogspot.com&amp;#47;2007&amp;#47;08&amp;#47;vtos-rtos-and-gethashcode-oh-my.html&amp;#91;&amp;#47;url&amp;#93; it would be cool to generate static proxy objects that do the comparison&amp;#47; hash code computation base on all the fields&amp;#47;properties &amp;#40;possibly only value-types or all, or those flagged with an attribute&amp;#41;. This would greatly reduce the amount of busy-work code while handling all the rules of GetHashCode.&lt;br /&gt;</description><author>IDisposable</author><pubDate>Wed, 28 Nov 2007 00:00:56 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Add support for automatic generation of Equals method and GetHashCode method 20071128120056A</guid></item><item><title>CREATED ISSUE: Add support for interfaces</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=14132</link><description>&amp;#91;From email&amp;#93;&lt;br /&gt;While I was experimenting with the DynamicComparer&amp;#60;T&amp;#62; class, I noticed that it works beautifully where T is a class.  When I tried to use an interface for T instead of a class, I get an exception on line 62 of DynamicComparer.cs.&lt;br /&gt; &lt;br /&gt;My thought is that the interface describes what a class must support, so why wouldn&amp;#39;t an interface work just as well&amp;#63;  Though, I&amp;#39;m not sure how the interface would affect code generation...should it&amp;#63;&lt;br /&gt; &lt;br /&gt;Let me give you an example to help highlight.  The example works with a file system &amp;#40;files and folders&amp;#41;.  In short, I want to optimally layout, using the minimum number of media &amp;#40;CD, DVD&amp;#41;, all files and folders the user has selected.  For me, even the size of folders is just as important as file size -- hence the abstraction to IItem &amp;#40;see below&amp;#41;.  Note&amp;#58; Your class works even in .NET 3.5&amp;#33;&amp;#33;  The example is a little longer than I had hoped, but I think it conveys the purpose in the Main&amp;#40;&amp;#41; method right up front.  Everything below that is just support.&lt;br /&gt; &lt;br /&gt;static class Program&lt;br /&gt;&amp;#123;&lt;br /&gt;    static void Main&amp;#40;&amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        DirectoryInfo dir &amp;#61; new DirectoryInfo&amp;#40; &amp;#64;&amp;#34;C&amp;#58;&amp;#92;Users&amp;#92;Rob&amp;#92;Documents&amp;#92;Projects&amp;#34; &amp;#41;&amp;#59;&lt;br /&gt;        FolderItem compilation &amp;#61; new FolderItem&amp;#40; dir &amp;#41;&amp;#59;   &amp;#47;&amp;#47; recursively builds a list of files and subfolders&lt;br /&gt; &lt;br /&gt;        &amp;#47;&amp;#47; get ready for Bin Packing problem&lt;br /&gt;        List&amp;#60;IItem&amp;#62; list &amp;#61; new List&amp;#60;IItem&amp;#62;&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;        AddCompilationToList&amp;#40; list, compilation &amp;#41;&amp;#59;    &amp;#47;&amp;#47; I do not show an implementation for this method as it is trivial&lt;br /&gt; &lt;br /&gt;        &amp;#47;&amp;#47; Of course, the UI may just want to sort by Size or by Name or by Location&lt;br /&gt;        &amp;#47;&amp;#47; But, this is what I&amp;#39;d like to do to sort files AND folders by their size &amp;#40;descending&amp;#41;, then location, then name&lt;br /&gt;        &amp;#47;&amp;#47;    This sort is needed when implementing the Bin Packing algorithm using First, Worst, or Best Item approaches&lt;br /&gt;        DynamicComparer&amp;#60;IItem&amp;#62; comparer &amp;#61; new DynamicComparer&amp;#60;IItem&amp;#62;&amp;#40; &amp;#34;Size DESC, Location, Name&amp;#34; &amp;#41;&amp;#59;&lt;br /&gt;        list.Sort&amp;#40; comparer.Comparer &amp;#41;&amp;#59;&lt;br /&gt; &lt;br /&gt;        &amp;#47;&amp;#47; now do one of the Bin Packing algorithms -- not shown for space&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt; &lt;br /&gt;interface IItem &amp;#58; IComparable&amp;#60;IItem&amp;#62;, IEquatable&amp;#60;IItem&amp;#62;&lt;br /&gt;&amp;#123;&lt;br /&gt;    IContainerItem Parent &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;    string Name &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;    string Location &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;    long Size &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt; &lt;br /&gt;interface IContainerItem &amp;#58; IItem&lt;br /&gt;&amp;#123;&lt;br /&gt;    ItemCollection Items &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;    IEnumerable&amp;#60;FileItem&amp;#62; Files &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;    IEnumerable&amp;#60;IContainerItem&amp;#62; Folders &amp;#123; get&amp;#59; &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt; &lt;br /&gt;class FileItem &amp;#58; IItem&lt;br /&gt;&amp;#123;&lt;br /&gt;    FileInfo _file&amp;#59;&lt;br /&gt; &lt;br /&gt;    public FileItem&amp;#40; FileInfo file &amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        _file &amp;#61; file&amp;#59;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public string Name&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _file.Name&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public string Location&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _file.DirectoryName&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public long Size&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _file.Length&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt; &lt;br /&gt;class FolderItem &amp;#58; IContainerItem&lt;br /&gt;&amp;#123;&lt;br /&gt;    DirectoryInfo _dir&amp;#59;&lt;br /&gt;    long _size&amp;#59;&lt;br /&gt; &lt;br /&gt;    public FolderItem&amp;#40; DirectoryInfo dir &amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        _dir &amp;#61; dir&amp;#59;&lt;br /&gt;        BuildTree&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public string Name&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _dir.Name&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public string Location&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _dir.FullName&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public long Size&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _size&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public ItemCollection Items&lt;br /&gt;    &amp;#123;&lt;br /&gt;        get &amp;#123; return _items&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public IEnumerable&amp;#60;FileItem&amp;#62; Files&lt;br /&gt;    &amp;#123;&lt;br /&gt;        &amp;#47;&amp;#47; Use LINQ to pull out only file from the ItemCollection&lt;br /&gt;        get &amp;#123; return &amp;#40;from item in Items where item is FileItem select item as FileItem&amp;#41;.AsEnumerable&amp;#60;FileItem&amp;#62;&amp;#40;&amp;#41;&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    public IEnumerable&amp;#60;IContainerItem&amp;#62; Folders&lt;br /&gt;    &amp;#123;&lt;br /&gt;        &amp;#47;&amp;#47; Use LINQ to pull out only folders &amp;#40;containers&amp;#41; from the ItemCollection&lt;br /&gt;        &amp;#47;&amp;#47; I have other types of IContainerItems which is why I don&amp;#39;t return FolderItem&lt;br /&gt;        get &amp;#123; return  &amp;#40; from item in Items &lt;br /&gt;                            where item is IContainerItem &lt;br /&gt;                            select item as IContainerItem&amp;#41;.AsEnumerable&amp;#60;IContainerItem&amp;#62;&amp;#40;&amp;#41;&amp;#59; &amp;#125;&lt;br /&gt;    &amp;#125;&lt;br /&gt; &lt;br /&gt;    private void BuildTree&amp;#40;&amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        &amp;#47;&amp;#47; use dir.GetFiles&amp;#40;&amp;#41; and dir.GetDirectories&amp;#40;&amp;#41; and convert each to FileItem and FolderItem respectively&lt;br /&gt;        &amp;#47;&amp;#47; recursively drill down each folder in dir.GetDirectories&amp;#40;&amp;#41;&lt;br /&gt;    &amp;#125;&lt;br /&gt;</description><author>IDisposable</author><pubDate>Tue, 27 Nov 2007 23:55:05 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Add support for interfaces 20071127115505P</guid></item><item><title>CLOSED ISSUE: Eliminate MethodAccessException for classes derived from generics</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=10576</link><description>EmitCall doesn't always generate legitimate methods if the method is implemented on a base class that is generic. Change the DynamicEmit helper class to only use EmitCall for VarArgs methods and use general Emit for all others.

Per this:
Hi. I found the solution. I changed Call method in DynamicEmit class to this:
 
public void Call(MethodInfo method)
        {
            if (method.IsFinal || !method.IsVirtual)
            {
                _ilGen.Emit(OpCodes.Call, method);
            }
            else
            {
                _ilGen.Emit(OpCodes.Callvirt, method);
            }
        }
 
Now everything works fine.
 
According to this http://blogs.msdn.com/haibo_luo/archive/2006/08/13/698719.aspx
EmitCall is mainly for varargs methods and you can (should) use Emit when you do not use varargs.
I do not understand MSIL but I might be a bug in EmitCall or I don't know.
 
Have a nice day.
 
Vlado </description><author>IDisposable</author><pubDate>Fri, 25 May 2007 20:08:31 GMT</pubDate><guid isPermaLink="false">CLOSED ISSUE: Eliminate MethodAccessException for classes derived from generics 20070525080831P</guid></item><item><title>CREATED ISSUE: Eliminate MethodAccessException for classes derived from generics</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=10576</link><description>Hi. I found the solution. I changed Call method in DynamicEmit class to this:
 
public void Call(MethodInfo method)
        {
            if (method.IsFinal || !method.IsVirtual)
            {
                _ilGen.Emit(OpCodes.Call, method);
            }
            else
            {
                _ilGen.Emit(OpCodes.Callvirt, method);
            }
        }
 
Now everything works fine.
 
According to this http://blogs.msdn.com/haibo_luo/archive/2006/08/13/698719.aspx
EmitCall is mainly for varargs methods and you can (should) use Emit when you do not use varargs.
I do not understand MSIL but I might be a bug in EmitCall or I don't know.
 
Have a nice day.
 
Vlado </description><author>IDisposable</author><pubDate>Fri, 25 May 2007 19:44:29 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Eliminate MethodAccessException for classes derived from generics 20070525074429P</guid></item><item><title>COMMENTED FEATURE: Allow sorting on object graph public properties</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=6443</link><description>It would be helpful if there were a simple way to sort objects deeper in the object graph via their public properties.

An Example Scenario:
Parent object has children objects with property of Firstname
The ability to specify an orderby (or alternative means) to sort by Parent.Child.Firstname (where Firstname is a public property of Child object) Comments: ** Comment from web user: chrisgraham ** &lt;p&gt;This would be a great feature to have, are there any plans to add this in the future&amp;#63;&lt;/p&gt;</description><author>chrisgraham</author><pubDate>Sun, 14 Jan 2007 09:02:39 GMT</pubDate><guid isPermaLink="false">COMMENTED FEATURE: Allow sorting on object graph public properties 20070114090239A</guid></item><item><title>COMMENTED FEATURE: Allow sorting on object graph public properties</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=6443</link><description>It would be helpful if there were a simple way to sort objects deeper in the object graph via their public properties.

An Example Scenario:
Parent object has children objects with property of Firstname
The ability to specify an orderby (or alternative means) to sort by Parent.Child.Firstname (where Firstname is a public property of Child object) Comments: This is an excellent idea, but there are some snags possible. The bindings to the methods will, by necessity, be based on the declared return types of the properties involved. This may affect what end-result property is called.</description><author>IDisposable</author><pubDate>Wed, 27 Dec 2006 18:02:23 GMT</pubDate><guid isPermaLink="false">COMMENTED FEATURE: Allow sorting on object graph public properties 20061227060223P</guid></item><item><title>CREATED FEATURE: Allow sorting on object graph public properties</title><link>http://www.codeplex.com/Dynamic/WorkItem/View.aspx?WorkItemId=6443</link><description>It would be helpful if there were a simple way to sort objects deeper in the object graph via their public properties.

An Example Scenario:
Parent object has children objects with property of Firstname
The ability to specify an orderby (or alternative means) to sort by Parent.Child.Firstname (where Firstname is a public property of Child object) </description><author>jafin</author><pubDate>Tue, 12 Dec 2006 23:11:13 GMT</pubDate><guid isPermaLink="false">CREATED FEATURE: Allow sorting on object graph public properties 20061212111113P</guid></item><item><title>CLOSED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5119</link><description>Extract the code that actually compares the parameter count and throws an exception into a helper method within ParameterCountMismatchException. This will reduce the size of the generated wrappers for the Params-type methods. This should improve the quality of the JIT code, and thus performance. Comments: Completed in 2.5.0.0</description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:46:28 GMT</pubDate><guid isPermaLink="false">CLOSED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size 20061103104628A</guid></item><item><title>CLOSED TASK: Improve XML Documentation</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5117</link><description>Add XML documentation to all public members of the Dynamic class. Comments: Completed in 2.5.0.0</description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:46:15 GMT</pubDate><guid isPermaLink="false">CLOSED TASK: Improve XML Documentation 20061103104615A</guid></item><item><title>CLOSED TASK: Refactor to remove redundant code.</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5118</link><description>Several bits of the actual Builder's Emit logic is duplicated between Constructor and Method and also between Params and Explicit paths. Refactor those methods out to reduce the amount of code, and reduce the memory footprint of the class itself. Comments: Completed in 2.5.0.0</description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:46:03 GMT</pubDate><guid isPermaLink="false">CLOSED TASK: Refactor to remove redundant code. 20061103104603A</guid></item><item><title>REOPENED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5119</link><description>Extract the code that actually compares the parameter count and throws an exception into a helper method within ParameterCountMismatchException. This will reduce the size of the generated wrappers for the Params-type methods. This should improve the quality of the JIT code, and thus performance. Comments: Completed in 2.5.0.0</description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:45:51 GMT</pubDate><guid isPermaLink="false">REOPENED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size 20061103104551A</guid></item><item><title>CLOSED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5119</link><description>Extract the code that actually compares the parameter count and throws an exception into a helper method within ParameterCountMismatchException. This will reduce the size of the generated wrappers for the Params-type methods. This should improve the quality of the JIT code, and thus performance. Comments: Completed in 2.5.0.0</description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:45:48 GMT</pubDate><guid isPermaLink="false">CLOSED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size 20061103104548A</guid></item><item><title>CREATED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5119</link><description>Extract the code that actually compares the parameter count and throws an exception into a helper method within ParameterCountMismatchException. This will reduce the size of the generated wrappers for the Params-type methods. This should improve the quality of the JIT code, and thus performance. </description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:45:20 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Add helper to ParameterCountMismatchException class to reduce code size 20061103104520A</guid></item><item><title>CREATED TASK: Refactor to remove redundant code.</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5118</link><description>Several bits of the actual Builder's Emit logic is duplicated between Constructor and Method and also between Params and Explicit paths. Refactor those methods out to reduce the amount of code, and reduce the memory footprint of the class itself. </description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:42:33 GMT</pubDate><guid isPermaLink="false">CREATED TASK: Refactor to remove redundant code. 20061103104233A</guid></item><item><title>CREATED TASK: Improve XML Documentation</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=5117</link><description>Add XML documentation to all public members of the Dynamic class. </description><author>IDisposable</author><pubDate>Fri, 03 Nov 2006 10:40:35 GMT</pubDate><guid isPermaLink="false">CREATED TASK: Improve XML Documentation 20061103104035A</guid></item><item><title>CREATED ISSUE: Add AccessorCache/</title><link>http://www.codeplex.com/WorkItem/View.aspx?ProjectName=Dynamic&amp;WorkItemId=3844</link><description>Integrate AccessorCache into the Dynamic library to handle caching of generated delegates for field or memeber accesses.

The AccessorCache is cached against a type (via automatic generic specialization of the .Net runtime) usingt the member name (field/property). It will automatically search for matching members and generate a suitable delegate for either setting or getting a field or property value.  The cached delegate is typesafe, but also can handle boxed values. </description><author>IDisposable</author><pubDate>Fri, 29 Sep 2006 20:02:03 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Add AccessorCache/ 20060929080203P</guid></item></channel></rss>