JToken Cast from operators (implicit vs explicit)

Sep 17, 2009 at 4:05 PM

I am using the latest source code from trunk/ and noticed that you added implicit "Cast to operators" in JToken.  It seems that the "Cast from operators" should also be implicit so that you can do code like this:

Currently you have to do this:

JObject jo = new JObject(
    new JProperty("foo", 10)
    );

int v = (int) jo["foo"];

It might be cleaner if you could do this:

JObject jo = new JObject(
    new JProperty("foo", 10)
    );

int v = jo["foo"];

~David

Coordinator
Sep 18, 2009 at 1:07 AM

I experimented making the cast from operators implicit but things get confusing when a JToken is used with a method that has overloads.