0

I need to pass a list (or array) of IP addresses and other information from C# code behind to the javascript function, which is in the external .js..

Also, this list may be long (1000+ items) .. What is the most efficient way to do this? can you provide a small example? should I use json serialization?

1
  • Isn't TList Delphi? Do you mean List<T>? Commented Nov 8, 2011 at 17:28

1 Answer 1

0

var myObject = <%= JustSerializeAsJson(...) %>; ... or pass it to a function to whatever. Point is JSON is a valid JavaScript literal so you can drop it in a number of places. Don't worry about "efficiency" here unless there is a profiled problem. Both the generation and JavaScript parsing should be really fast. (Bing maps loads like 1MB file in JS!)

MSDN JSON Serializer

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.