<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/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>C#</title><link>http://forums.asp.net/37.aspx</link><description>Discussions/Questions about the C# language. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=13&amp;c=23" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: decimal or double multiplication ??</title><link>http://forums.asp.net/thread/493194.aspx</link><pubDate>Tue, 02 Mar 2004 22:19:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:493194</guid><dc:creator>yanywg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/493194.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=493194</wfw:commentRss><description>Thanks, I figured it out !</description></item><item><title>Re: decimal or double multiplication ??</title><link>http://forums.asp.net/thread/493182.aspx</link><pubDate>Tue, 02 Mar 2004 22:09:17 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:493182</guid><dc:creator>yanywg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/493182.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=493182</wfw:commentRss><description>Thank you very much !
&lt;br /&gt;
My question is: if I have a piece of value passed through a method call. The type of this value could be string or double. How could I convert it to decimal ? I tried, but no success.
&lt;br /&gt;
Is there a way we can do it ?
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
Thanks,
&lt;br /&gt;
YL</description></item><item><title>Re: decimal or double multiplication ??</title><link>http://forums.asp.net/thread/490744.aspx</link><pubDate>Sun, 29 Feb 2004 20:18:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:490744</guid><dc:creator>Roscoe Brooks</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/490744.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=490744</wfw:commentRss><description>In an expression with two operands, both of type decimal, the return will be of type decimal. This is true regardless if these operands are both literals suffixed with &amp;quot;M&amp;quot;, or variables declared as type Decimal, or one of each.&lt;br /&gt;
&lt;br /&gt;
In the example below, three multiplication statements are executed. Note that although these statements differ in syntax, they are semantically similiar: they all multiply the decimal values 6.43 and 0.05 and return the result as a decimal type. So the answer to your question about the Rate variable is: just declare it a decimal type and you&amp;#39;re set - no &amp;quot;M&amp;quot; required.&lt;br /&gt;
&lt;br /&gt;
// Sample C# code ...&lt;br /&gt;
decimal Number1;&lt;br /&gt;
decimal Number2;&lt;br /&gt;
decimal Number3;&lt;br /&gt;
decimal Number4;&lt;br /&gt;
decimal Rate;&lt;br /&gt;
&lt;br /&gt;
// First operand is decimal variable. Second operand is decimal literal.&lt;br /&gt;
Number1 = 6.43M;&lt;br /&gt;
Number2 = Number1 * 0.05M;&lt;br /&gt;
Console.WriteLine(Number2);&lt;br /&gt;
&lt;br /&gt;
// Both operands are decimal variables.&lt;br /&gt;
Rate = 0.05M;&lt;br /&gt;
Number3 = Number1 * Rate;&lt;br /&gt;
Console.WriteLine(Number3);&lt;br /&gt;
&lt;br /&gt;
// Both operands are decimal literals.&lt;br /&gt;
Number4 = 6.43M * 0.05M;&lt;br /&gt;
Console.WriteLine(Number4);</description></item><item><title>Re: decimal or double multiplication ??</title><link>http://forums.asp.net/thread/489793.aspx</link><pubDate>Fri, 27 Feb 2004 22:34:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:489793</guid><dc:creator>yanywg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/489793.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=489793</wfw:commentRss><description>I figured out that I had to add 'M' as suffix to the decimal so the compiler could recognize it as DECIMAL instead of DOUBLE, like this: 0.05m. odd!
&lt;br /&gt;

&lt;br /&gt;
But the issue still there, if I have a variable to hold the decimal number, what can I do ?
&lt;br /&gt;
for exampe: the variable name is Rate, can I do this : Ratem ?  NO !!!..   what can I do ?
&lt;br /&gt;

&lt;br /&gt;
Please help !!
&lt;br /&gt;

&lt;br /&gt;</description></item><item><title>decimal or double multiplication ??</title><link>http://forums.asp.net/thread/489686.aspx</link><pubDate>Fri, 27 Feb 2004 20:49:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:489686</guid><dc:creator>yanywg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/489686.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=37&amp;PostID=489686</wfw:commentRss><description>I have a problem as follows :
&lt;br /&gt;

&lt;br /&gt;
---code
&lt;br /&gt;
decimal Number1;
&lt;br /&gt;
decimal Number2;
&lt;br /&gt;
Number1 = 6.43;
&lt;br /&gt;
Number2 = Number1 * 0.05;
&lt;br /&gt;

&lt;br /&gt;
--end of code
&lt;br /&gt;

&lt;br /&gt;
I got the build error :
&lt;br /&gt;

&lt;br /&gt;
Operator '*' cannot be applied to operands of type 'decimal' and 'double';
&lt;br /&gt;

&lt;br /&gt;
please help !
&lt;br /&gt;

&lt;br /&gt;
YL
&lt;br /&gt;

&lt;br /&gt;</description></item></channel></rss>