Skip to main content

Microsoft Silverlight

Answered Question When do you use C# and when do you use Javascript?RSS Feed

(0)

j_programmer
j_progra...

Member

Member

24 points

16 Posts

When do you use C# and when do you use Javascript?

Seen several examples and sometimes the C# is used and sometimes Javascript is used in the .js file.  When I want to begin a timeline (Timeline1.begin()), for example, I use c# in the code behind.  I've seen other people use javascript when the have a play or pause button.  Both seem to work, so I'm not sure what the difference is.  Different things seem to be exposed in both too.  I'm lost on it.

 

Thanks.

swirlingmass
swirling...

Participant

Participant

1348 points

385 Posts

Answered Question

Re: When do you use C# and when do you use Javascript?

It depends what version you're developing.  For 1.0, you have to use javascript.  For 1.1, you can use whatever you want.  I think mostly, you would want to use C# if you can, because that's the whole point of 1.1 (being able to use managed code).  There are a handful of things that you might have to use javascript for, or might be easier with javascript, but they're roughly equivalent.  So there really isn't much difference, it's more a matter of personal preference.

y_makram
y_makram

Contributor

Contributor

6172 points

1,233 Posts

Re: When do you use C# and when do you use Javascript?

I agree, in 1.1 it is a matter of preference. Dynamic languages like Ruby and JS has the advantage of simplicity, and ease of development. Static languages like C# has the advantage of strong typing and compiler support.

Thanks
Yasser Makram
http://www.silverlightrecipes.com
_____
Dont forget to click "Mark as Answer" on the post that helped you. If your question has not been answered, please post a followup question.

j_programmer
j_progra...

Member

Member

24 points

16 Posts

Re: Re: When do you use C# and when do you use Javascript?

Then why would I want to do anything in 1.0, if 1.1 uses all of .NET and seems to right around the corner?  It doesn't look like it makes much sense to use 1.0.

swirlingmass
swirling...

Participant

Participant

1348 points

385 Posts

Answered Question

Re: Re: When do you use C# and when do you use Javascript?

Here are a few reasons I came up with.  Sorry they're all sorta run together.

I don't think 1.1 is right around the corner.  It's still in Alpha.  There's no official word as far as I know, but I've heard speculation that it will be released around summer of '08.  That's almost a year away!  1.0 is pretty much here now.  I don't think many businesses would want to use an alpha.  Although I would expect the two versions to merge at some point, for now they are separate, and 1.1. requires the 1.1 plugin, whereas 1.0 works with either.  Also, 1.1 doesn't exactly use all of .Net.  There are some pretty big restrictions on what you have access to, due to security considerations, which means some of the things you take for granted in developing a web application (ex. Response.Write) aren't going to be directly available to you.  Developing in 1.0 doesn't require Visual Studio.  Some people also might simply find javascript easier to work with.  Right now, it looks like there's more and better documentation for 1.0.

But yeah, a lot of people are just kind of ignoring 1.0 and focusing on 1,1.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities