Please Expose Internal Utils

Jan 16, 2009 at 11:09 PM
There's some gold hidden in your utils, but they are all marked internal :(

For now I've copied a lot of that code, but would really rather just call your version. In particular I need the ConvertUtils, ReflectionUtils and CollectionUtils (to some extent). It turns out that JSON isn't the only textual format for data and supporting others is something I have to do quite a bit.

Coordinator
Jan 18, 2009 at 8:04 AM
They are all internal utilities and don't have anything to do with JSON. I want to keep Json.NET focused.

Everything is open source so copying, like you've already done, works :)
Jan 19, 2009 at 3:16 PM
It's certainly your code and your call. :(

IMHO, though, a layered approach like you have done in no way precludes exposing those layers. Copying eliminates a major benefit of code reuse by cutting us off from ongoing bug fixes. As these layers represent a major part of the complexity of the problem, they are of direct benefit to others facing similar problems. For example, in the Java universe, the Jakarta BeanUtils package exposes its ConvertUtils subpackages for public consumption - and I've gotten as much benefit from those as the higher-level package.

FWIW, copying what I needed took several hours of clipping and refactoring... not an ideal thing given that the code is "right there" and just blocked by a few strategic "internal" keywords ;)
Mar 22, 2009 at 9:07 PM
I actually wish some of them were set to public as well.  I'm writing a converter for a custom data type right now and I can't really use any of the built-in JsonConverters as a template because they all use your really spiffy extension methods and other fun tools.  Things that "FormatWidth" extension method are pretty cool!  I know I can copy them over, but like dgriffen, it is duplicating what you've got already.

 throw new Exception("Unexpected value when converting date. Expected DateTime or DateTimeOffset, got {0}.".FormatWith(CultureInfo.InvariantCulture, ReflectionUtils.GetObjectType(value)));

I can understand why you might hesitate though--in addition to what you've already said, you'd also have to worry about changing the interfaces on these utilities.  But man, they are really cool! Shoot, some of them are cool enough you ought to fork them into a separate project.
Coordinator
Mar 23, 2009 at 3:15 AM
Like this one?

http://utilities.codeplex.com/

:P

I recommend getting the latest source and building from that. The 1.0 version is way out of date. One day I'll get organised and release a new version from the source...
Mar 23, 2009 at 4:00 PM
Yes, like that one :-)
Sep 16, 2010 at 11:48 PM

I created a follow up work item here:

http://utilities.codeplex.com/workitem/11945

Thank you.