13
Reply

C# class or no class... question from newbie

Arthur

Arthur

Nov 2 2010 2:03 PM
14.4k
Hi all,
I'm new to C# and have a question please. Here's the problem. I'm trying to modify some C# program where I call some methods within if... else if... directives repeatedly:

              if (some val >= 40 && other val < 0)
                {
                DrawArrowDown("MyDnArrow" , true, 1, (hh+0.0002), Color.OrangeRed);
                DrawDiamond("MyDiamond", true, 1, (hh+0.0011), Color.Blue);
                DrawTriangleDown("MyDownTriangle", true, 1, (hh+0.0013), Color.Blue);
                }
               else if (some val < 40... && ... >=30 ...)
                {
                DrawArrowDown("MyDnArrow" , true, 1, (hh+0.0002), Color.OrangeRed);
                DrawDiamond("MyDiamond", true, 1, (hh+0.0011), Color.Blue);
                DrawTriangleDown("MyDownTriangle", true, 1, (hh+0.0013), Color.Blue);
                }
               else if (some val < 30... && ... >=20 ...)
                {
                DrawArrowDown("MyDnArrow" , true, 1, (hh+0.0002), Color.OrangeRed);
                DrawDiamond("MyDiamond", true, 1, (hh+0.0011), Color.Blue);
                DrawTriangleDown("MyDownTriangle", true, 1, (hh+0.0013), Color.Blue);
                }
               else if...

I came from Oracle PL/SQL world where there used to be no classes but procedures, functions and packages... In Oracle I'd simply create some procedure with parameters to call those repetitive Draw...() statements, smth like this: Procedure PlotSignals(arrowhandle, true, arrow_pos, color)... and call this proc. in if... else if... passing the correct parameters. How can I simplify this and create some procedure in C# please? Any examples would be much appreciated.
Thank you very much.


Answers (13)