convert javascript to c#

hi i have a javascript that i need to convert to c#

pls help

i need it in c#  not to register the script

thanks in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ted BouskillSenior Software DeveloperCommented:
You have to execute a complete rewrite.  They are very different languages in some key areas.  I've never seen a tool for doing it.
Alexandre SimõesManager / Technology SpecialistCommented:
If you're searching for an automatic conversion tool I don't think you'll find one.
Looking at your code I don't see any special pieces that could be hard to convert... all seems straight forward.

So if you know javascript and know c# get your hands durty and start converting it :)
Most should be much alike... try not to implement new types of arrays and such, do it as a direct conversion and later on, once working, you can optimize it.

simple guide:
> Create a class
> All those variables, are propreties withing the class
> The Arrays may be as so or List = new List(){0.48776710986118343,-2.1891394877398853}
> Add the functions nothing special pops...

Good luck!
As the above comments suggested, there is no easy way.  Here is what I  would do:
  1. Copy/Rename JS file to CS file
  2. put "class JSCode {" at top of file and } at bottom of file.
  3. Replace all "function " with "void "
  4. Replace all "VAR  " with "object " (If you are using visual studio 2008 you may be able to skip this step)
  5. Compile the code and go through the errors. (almost guaranteed it won't work the first time)
    1. If the error is because you have a "return" statement change the function's return type from void to actual type returned.
    2. If the error is because you have used a variable incorrectly, correct the "object" type to the correct type.
    3. If the error is because you are using Browser specific API's (i.e. document.getElementById('Button1')) then replace them with the proper server side API (i.e. this.Button1
    4. ...other unknown error message fixes...
Some code will not be able to be converted because the functionality can only be performed on the client.  (i.e. dynamically building HTML code)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I don't know if i understood your question. JavaScript is an interpreted language, while c# is compiled. They are designed to achieve different goals. Could you explain better what are you trying to do?
best regards.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.