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


C# PropertyList.GetType方法代码示例

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


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

示例1: Page_PreRenderComplete

    protected void Page_PreRenderComplete(object sender, EventArgs e)
    {
        HotelSearchRS objHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"];

        PropertyList objPropertyList = new PropertyList();
        objPropertyList.Property = new WBS_Property[0];

        if (objHotelSearchRS.ResponseHeader.Success)
        {
            List<WBS_Property> lProperties = new List<WBS_Property>();

            if (objHotelSearchRS.HotelListItems != null)
            {
                List<string> lBrandCodes = new List<string>();

                for (int i = 0; i < objHotelSearchRS.HotelListItems.Length; i++)
                {
                    if (!lBrandCodes.Contains(objHotelSearchRS.HotelListItems[i].BrandCode))
                        lBrandCodes.Add(objHotelSearchRS.HotelListItems[i].BrandCode);
                }

                lBrandCodes.Sort();

                for (int i = 0; i < lBrandCodes.Count; i++)
                {
                    for (int j = 0; j < objHotelSearchRS.HotelListItems.Length; j++)
                    {
                        if (objHotelSearchRS.HotelListItems[j].BrandCode == lBrandCodes[i])
                        {
                            WBS_Property objProperty = new WBS_Property();
                            lProperties.Add(objProperty);

                            objProperty.HotelCode = objHotelSearchRS.HotelListItems[j].HotelCode;
                            objProperty.HotelName = objHotelSearchRS.HotelListItems[j].HotelName;
                            objProperty.BrandCode = objHotelSearchRS.HotelListItems[j].BrandCode;
                            objProperty.BrandName = objHotelSearchRS.HotelListItems[j].BrandName;

                            if (objHotelSearchRS.HotelListItems[j].AreaIDs != null && objHotelSearchRS.HotelListItems[j].AreaIDs.Length != 0)
                            {
                                List<WBS_Area> lAreas = new List<WBS_Area>();

                                for (int k = 0; k < objHotelSearchRS.HotelListItems[j].AreaIDs.Length; k++)
                                {
                                    WBS_Area objArea = new WBS_Area();
                                    lAreas.Add(objArea);

                                    objArea.AreaID = objHotelSearchRS.HotelListItems[j].AreaIDs[k];
                                }

                                objProperty.Areas = lAreas.ToArray();
                            }

                        }

                    }

                }

            }

            objPropertyList.Property = lProperties.ToArray();
        }

        XmlSerializer ser = new XmlSerializer(objPropertyList.GetType());
        MemoryStream ms = new MemoryStream();
        ser.Serialize(ms, objPropertyList);

        UTF8Encoding utf8 = new UTF8Encoding();
        string strPropertyListXML = utf8.GetString(ms.ToArray());
        ms.Close();

        try
        {
            HttpContext.Current.Response.ContentType = "text/xml";
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(strPropertyListXML);
            HttpContext.Current.Response.Flush();
            HttpContext.Current.Response.End();
        }

        catch (System.Threading.ThreadAbortException)
        {
            // Ignore -- html output always terminated since the xml
            // response document only is to go out to client.

            return;
        }

        Session.Abandon();

        return;
    }
开发者ID:rchelms,项目名称:XnHotelSystemsStagingSite,代码行数:92,代码来源:PropertyListInfo.aspx.cs


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