Redian新闻
>
一个好用的arrayToString
avatar
m*c
2

It seems to me that the author uses array so frequently that he had to come up
a "generic" method to convert Array to String. Maybe he should start to learn
to use other types of data structure (or even OOP) to solve his problme :-)

【在 p***p 的大作中提到】
: http://www.codeproject.com/useritems/ArrayToString.asp
avatar
c*t
3
Not really, this problem is very useful in debugging. Sometimes you
want to dump large matrices, sometimes some data files has unknown dimenions
(such as raw data coming from NetCDF). I have my own multi-dimensional
data output/cloning routines for this kind of purposes.

【在 m**c 的大作中提到】
:
: It seems to me that the author uses array so frequently that he had to come up
: a "generic" method to convert Array to String. Maybe he should start to learn
: to use other types of data structure (or even OOP) to solve his problme :-)

avatar
m*c
4

come up
learn
For unknown dimension data, isn't it better to use dynamic dimension data
structure such as List (ordered or not) to store the data instead of static
array structure? Also you can store Lists inside List. To dubug this kind of
data structures, you can simply use/overwrite "toString()" (you can create
your own data structure as the list of List):
... class MyList {
private List _listOfList;
...
public void add (List childList) {
_listOfList.add(childList);


【在 c*****t 的大作中提到】
: Not really, this problem is very useful in debugging. Sometimes you
: want to dump large matrices, sometimes some data files has unknown dimenions
: (such as raw data coming from NetCDF). I have my own multi-dimensional
: data output/cloning routines for this kind of purposes.

avatar
c*t
5
Gosh, sometimes it is not what you want to use, it is what you have given.
Also, access with multi-dimensional data with array is fast and simple, as
in rotation matrices. Sometimes, it is nice to have 1 routine to output
whatever array data.

【在 m**c 的大作中提到】
:
: come up
: learn
: For unknown dimension data, isn't it better to use dynamic dimension data
: structure such as List (ordered or not) to store the data instead of static
: array structure? Also you can store Lists inside List. To dubug this kind of
: data structures, you can simply use/overwrite "toString()" (you can create
: your own data structure as the list of List):
: ... class MyList {
: private List _listOfList;

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。