<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Issues concerning X++  : CLR-Interop</title><link>http://blogs.msdn.com/x/archive/tags/CLR-Interop/default.aspx</link><description>Tags: CLR-Interop</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Missing values: getting the System.Missing.Value value</title><link>http://blogs.msdn.com/x/archive/2008/01/15/missing-values-getting-the-system-missing-value-value.aspx</link><pubDate>Tue, 15 Jan 2008 22:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7119626</guid><dc:creator>pvillads</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/x/comments/7119626.aspx</comments><wfw:commentRss>http://blogs.msdn.com/x/commentrss.aspx?PostID=7119626</wfw:commentRss><description>&lt;P&gt;When dealing with office integration scenarios and when calling APIs that are based on old COM interfaces, there&amp;nbsp; is a need to specify that&amp;nbsp;a value is not provided. The notmal way to do this (say, in C#) is to use &lt;/P&gt;
&lt;P&gt;System.Reflection.Missing.Value&lt;/P&gt;
&lt;P&gt;Now, as it happens, Value is not a static property, as one might expect, but instead a public static field. It is currently not possible in X++ to reference the value of a field.&lt;/P&gt;
&lt;P&gt;There are at least two ways to solve the problem: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You can use a managed method to get the value. This has the disadvantage that you need to put this glue code in an assembly that is deployed to your Ax installation. This may or may not be a problem, depending on your situation, but it is not exactly elegant.&lt;/LI&gt;
&lt;LI&gt;Or, you can use reflection from X++ to get the value, as shown here:&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &amp;nbsp;System.Type type = System.Type::GetType(&lt;SPAN style="COLOR: #8b0000"&gt;"System.Reflection.Missing"&lt;/SPAN&gt;); &lt;BR&gt;&amp;nbsp; &amp;nbsp;System.Reflection.FieldInfo info = type.GetField(&lt;SPAN style="COLOR: #8b0000"&gt;"Value"&lt;/SPAN&gt;); &lt;BR&gt;&amp;nbsp; &amp;nbsp;System.Object value = info.GetValue(&lt;SPAN style="COLOR: #0000ff"&gt;null&lt;/SPAN&gt;); &lt;BR&gt;&lt;BR&gt;
&lt;P mce_keep="true"&gt;This has a performance penalty involved, but that can rpobably be ignored in most cases.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7119626" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/x/archive/tags/CLR-Interop/default.aspx">CLR-Interop</category></item><item><title>CLR interop: Passing Int16 values to managed code.</title><link>http://blogs.msdn.com/x/archive/2007/07/02/clr-interop-passing-int16-values-to-managed-code.aspx</link><pubDate>Mon, 02 Jul 2007 19:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3661437</guid><dc:creator>pvillads</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/x/comments/3661437.aspx</comments><wfw:commentRss>http://blogs.msdn.com/x/commentrss.aspx?PostID=3661437</wfw:commentRss><description>&lt;P&gt;As you all know, Dynamics AX supports 32 bit integers in its int datatype. However, sometimes you need to transfer an int16 value to a managed method. Currently the easiest way to acheive this is by doing:&lt;/P&gt;&lt;SPAN style="COLOR: #0000ff"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;void&lt;/SPAN&gt; Job2(Args _args) &lt;BR&gt;{ 
&lt;DIV style="MARGIN-LEFT: 2em"&gt;System.Int16 &lt;SPAN style="COLOR: #0000ff"&gt;short&lt;/SPAN&gt;; &lt;BR&gt;&lt;SPAN style="COLOR: #0000ff"&gt;int&lt;/SPAN&gt; num = &lt;SPAN style="COLOR: #8b0000"&gt;2356&lt;/SPAN&gt;; &lt;BR&gt;; &lt;BR&gt;&lt;BR&gt;&lt;SPAN style="COLOR: #0000ff"&gt;short&lt;/SPAN&gt; = System.Convert::ToInt16(num); &lt;BR&gt;&lt;BR&gt;print &lt;SPAN style="COLOR: #0000ff"&gt;short&lt;/SPAN&gt;; &lt;BR&gt;pause; &lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;} &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3661437" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/x/archive/tags/CLR-Interop/default.aspx">CLR-Interop</category></item></channel></rss>