System.Math namespace missing
Author: MustPlayOptions
Creation Date: 4/16/2009 9:29 PM
profile picture

MustPlayOptions

#1
Hi,

I have VB.Net and when I use that I can find the System.Math namespace with no problem. For some reason when I try:

using System.Math

WL can't find it. The options for the various System classes pops up but the Math one is nowhere to be found. I assume it's a configuration thing but couldn't find any documentation about it.

Can someone please help me figure out what I'm missing?

Thanks,
MPO
profile picture

Eugene

#2
It's working correctly. System.Math is not a namespace, it's a class, so the using directive doesn't apply here. Just type in Math. in your Strategy and code completion will work.
profile picture

Cone

#3
QUOTE:
it's a class
Right, and specifically it's a static class in the System namespace. You don't create instances of static classes to use them; as Eugene said, just type "Math." and all the functions will pop up.
profile picture

MustPlayOptions

#4
Thanks, but that's the problem. I was copying a strategy from another post that had Math.abs() and after trying to compile it is said it was missing, that's why I tried to do the using System.Math thing.

The exact thing it says is "the name 'math' does not exist in the current context.

"just type "Math." and all the functions will pop up."

This doesn't happen.

Thanks,
MPO
profile picture

Eugene

#5
Can you point us to that strategy or show the code?
profile picture

MustPlayOptions

#6
Sure. You might recognize it since you wrote it :)

/Forum/Posts/Help-code-a-Shooting-Star-strategy-with-multiple-profit-targets-29112

It's the "Can someone help writing a script for this strateg " post in the strategies section.

Thanks.
profile picture

MustPlayOptions

#7
Ok, I figured it out...

First I tried system.math.abs and it said the same thing about "system" which is obviously wrong. then I tried "System" with a capital "s" and then the options popped up including "Math" and then "Abs". In VB.net the names are not case specific but apparently the compiler for WL5 is.

Sorry for the confusion but I wouldn't have figured it out if you guys didn't suggest that it should pop-up the functions so thank you.

I still don't know why it didn't work before since it was copied and pasted but it worked after I typed it in.
profile picture

Eugene

#8
My bad, I've noticed a mention of "System.abs" in one of your posts above but thought 'twas a typo. Now you know C# is unforgiving when it comes to context-sensitivity. ;)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).