标题:求助:类对象数组初始化问题
只看楼主
hnzzc
Rank: 1
等 级:新手上路
帖 子:86
专家分:0
注 册:2006-4-26
 问题点数:0 回复次数:1 
求助:类对象数组初始化问题
using System;
    using System.Text;
    using System.Collections;
    using
    using System.Data;

    namespace d
    {
                public class ListNode
        {
            public string[]keys;
            public ListNode link;
            public  int Length;
            public ListNode()
            {
                link=null;
                keys=new string[10];
                Length=10;
            }

            public ListNode(string[]key,int len)
            {
                int i=0;
                Length=len;
                keys=new string[len];
                foreach(string c in key)
                {
                    keys[i]=c;
                    i++;
                }
                link=null;
            }

        }


        public class List
        {
            private ListNode Head;
            private ListNode Tail;
            private ListNode Current;
            private int index;

            public List()
            {
                Head=null;
                Tail=null;
                index=0;
            }

            /// <summary>
            /// 尾部添加数据
            /// </summary>

            public void Append(string [] key,int n )
            {
                ListNode NewNode=new ListNode(key,n );
                if (index==0)  //如果头指针为空
                {
                    Head=NewNode;
                    Tail=NewNode;
                }
                else
                {
                    Tail.link =NewNode;
                    Tail=NewNode;
                }
                Current=NewNode;
                index+=1;//链表数据个数加一
            }
                    
            public  void RadixSort(int d,int radix)   //基数排序
            {
                
                ListNode[] front= new ListNode[radix];
                ListNode []rear=new ListNode[radix];
                for(int i=0;i<radix;i++)       //初始化
                {
                    front[i]=new ListNode();
                    rear[i]=new ListNode();
                    Console.WriteLine("{}",i.ToString());
                }

                            }

            
    }
红色部分调试时错误
错误:未处理的“System.FormatException”类型的异常出现在 mscorlib.dll 中。

其他信息: 输入字符串的格式不正确。


[[it] 本帖最后由 hnzzc 于 2008-3-26 11:35 编辑 [/it]]
搜索更多相关主题的帖子: public using string System 对象 
2008-03-26 10:54
hnzzc
Rank: 1
等 级:新手上路
帖 子:86
专家分:0
注 册:2006-4-26
得分:0 
这个问题已经解决,原来是Console.WriteLine("{}",i.ToString());应该Console.WriteLine("{0}",i.ToString());

[[it] 本帖最后由 hnzzc 于 2008-3-26 12:42 编辑 [/it]]
2008-03-26 11:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-205406-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.358314 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved