开发者

Can Ruby read a .dat file created in VB.NET?

How would I create a list of elements in VB.NET, save it to a .dat开发者_运维百科 file, and make Ruby re-create such list (as an array) with such elements (they will be strings, booleans and integers)?


You can do it, but you'd need to find some representation for it. The easiest is probably JSON, so you would

  1. make the data structure in VB
  2. write it to JSON as a file
  3. read the JSON file using Ruby.

Here's a JSON serializer for .Net:


A .dat file is just a binary blob, 'tis it not? If there's any particular format you use you could easily translate that to equivalent Ruby code. Just as long as the knowledge is duplicated on both ends, though that leads to a violation of the DRY principle. JSON might be a good intermediate representation (as noted by @Charlie Martin) because it's a plain text format and you can always add compression.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜