当前位置: 首页>>代码示例>>C#>>正文


C# City.GetType方法代码示例

本文整理汇总了C#中City.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# City.GetType方法的具体用法?C# City.GetType怎么用?C# City.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在City的用法示例。


在下文中一共展示了City.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Next

 public void Next(City c)
 {
     WriteType(c.GetType(), c);
 }
开发者ID:mjenny,项目名称:ECNF,代码行数:4,代码来源:SimpleObjectWriter.cs

示例2: Fill

        public void Fill()
        {
            m_hasPutOnMap = false;

            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                // let's hope it is good XML and we can load it the easy way:
                xmlDoc.Load(m_fileName);

                // we want to traverse XmlDocument fast, as tile load operations can be numerous
                // and come in pack. So we avoid using XPath and rely mostly on "foreach child":
                foreach(XmlNode nnode in xmlDoc.ChildNodes)
                {
                    if(nnode.Name.Equals("features"))
                    {
                        foreach(XmlNode node in nnode)
                        {
                            try
                            {
                                string type = node.Name;
                                if(type.Equals("name"))
                                {
                                    Place place = new Place(node);
                                    if(place.Importance > 0 && !place.Name.Equals("NAME NOT KNOWN")) {
                                        // if(checkForDuplicates) {
                                        bool found = false;
                                        foreach(LiveObject lo in m_list)
                                        {
                                            if(lo.GetType().Equals(place.GetType()))
                                            {
                                                Place p = (Place)lo;
                                                if (p.sameAs(place))
                                                {
                                                    found = true;
                                                    //LibSys.StatusBar.Trace("duplicate PLACE: " + place + " to " + p);
                                                    break;
                                                }
                                            }
                                        }
                                        if(!found)
                                        {
                                            m_list.Add(place);
                                            namesCount++;
                                        }
                                        // } else {	// checkForDuplicates
                                        //     m_list.Add(place);
                                        //	   namesCount++;
                                        // }
                                    }
                                }
                                else if(type.Equals("ppl"))
                                {
                                    City city = new City(node);
                                    if(checkForDuplicates)
                                    {
                                        bool found = false;
                                        foreach(LiveObject lo in m_list)
                                        {
                                            if(lo.GetType().Equals(city.GetType()))
                                            {
                                                City c = (City)lo;
                                                if (c.sameAs(city))
                                                {
                                                    found = true;
                                                    break;
                                                }
                                            }
                                        }
                                        if(!found)
                                        {
                                            m_list.Add(city);
                                            citiesCount++;
                                        }
                                    }
                                    else
                                    {
                                        m_list.Add(city);
                                        citiesCount++;
                                    }
                                }
                            }
                            catch (Exception ee)
                            {
                                // bad node, no big deal. Just continue.
                                LibSys.StatusBar.Error("Features:Fill() bad node: " + ee.Message);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // bad XML. Try to load it the old way.
            #if DEBUG
                LibSys.StatusBar.Trace("Warning: Features:Fill(): " + m_fileName + " - bad XML. Loading old style");
            #endif
                StreamReader stream = null;
                try
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:Features.cs


注:本文中的City.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。