当前位置:编程学习 > C#/ASP.NET >>

在C#中怎样实现指向类的指针数组

代码如下:
想实现下代码,要在C#中实际指向类的指针
 unsafe class Algorithms
    {
        public void FindPath(string findodfname,ODF* curODF,int findlevel,Stack<string> passpath ,ArrayList savepath)
        {
            

            if (findodfname == curODF.ODFname) 
                {
                    Console.WriteLine("Find OUT");
                    Console.WriteLine(passpath.ToString()); 
                    return;
                }

            if (0 == findlevel)
                {
                    return;
                }

            for (int i = 0; i < curODF.Neighourcount; i++)
            {
                if (!passpath.Contains(curODF .nextodf[i]->ODFname))
                {
                    passpath.Push(curODF.ODFname); 
                    FindPath(findodfname, &curODF.nextodf[i], findlevel--, passpath, savepath);
                    passpath.Pop();
                    return;
                }
                else
                    return;
            }
        }
    }

 unsafe class ODF
    {
        public string ODFname;
        public int ODFtype;
        public ODF*[] nextodf;
        public int Neighourcount;
        //public ODU odu[12];
        public ODF()
        {
            ODFname = "Noname";
            ODFtype = 0;
            nextodf = new ODF*[12];
            Neighourcount = 0;

        }

    } --------------------编程问答-------------------- 使用ArrayList

或者是对象数组就可以了。

C#里基本不用指针。
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,