Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 51446

Try catch and finally in new Dynamics Ax (aka AX7)

$
0
0

Finally I found that in new Dynamics Ax finally statement introduce in exception handling statement.

try
{
}catch
{
}finally
{
}

It means, everything written in finally must be execute. For testing this functionality I just create a runnable class and written following code.

class HelloWorld

{

/// <summary>/// Runs the class with the specified arguments./// </summary>/// <param name = "_args">The specified arguments.</param>

public static void main(Args _args)

{

ColorDC dc = new ColorDC();

ColorSc Sc = new ColorSc();

 

try

{

dc.parmColorName("Red");

Sc.InsertColor(dc);

dc.parmColorName("Green");

Sc.InsertColor(dc);

} catch (Exception::Error)

{

info("error");

}

finally

{

info("finally");

}

 

 

}

 

}

 

When run the code.

I found Info box in browser as

2016-01-24_12-47-01


Viewing all articles
Browse latest Browse all 51446

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>