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


C# Hashtable.GetType方法代码示例

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


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

示例1: arr2xml

        private static void arr2xml(XmlWriter xml, Hashtable data) {
            string substr = "";
            int status = 0;
            if (data != null && data.GetType().ToString() == "System.Collections.Hashtable") {
                foreach (DictionaryEntry item in data) {
                    if (item.Value.GetType().ToString() == "System.Collections.Hashtable") {
                        xml.WriteStartElement(item.Key.ToString());
                        Hashtable v2 = item.Value as Hashtable;
                        OpenPayU.arr2xml(xml, v2);
                        xml.WriteEndElement();
                        status = 0;
                        continue;
                    } else {
                        status = 0;
                        substr = item.Value.GetType().ToString();
                        if (substr.Length > 30)
                            substr = item.Value.GetType().ToString().Substring(0, 32);
                        if (substr == "System.Collections.Generic.Stack") {
                            xml.WriteStartElement(item.Key.ToString());
                            status = 1;
                            Stack<Hashtable> v3 = item.Value as Stack<Hashtable>;
                            foreach (Hashtable item2 in v3) {

                                Hashtable v4 = item2 as Hashtable;
                                OpenPayU.arr2xml(xml, v4);

                            }
                            xml.WriteEndElement();
                            continue;
                        }
                    }
                    if (status == 0)
                        xml.WriteElementString(item.Key.ToString(), item.Value.ToString());
                    status = 0;
                }
            }
        }
开发者ID:yalcines,项目名称:PayULib,代码行数:37,代码来源:OpenPayU.cs

示例2: CreateTryGetValueDelegateWrapsNonGenericDictionaries

        public void CreateTryGetValueDelegateWrapsNonGenericDictionaries()
        {
            // Arrange
            object dictionary = new Hashtable()
            {
                { "foo", 42 }
            };

            // Act
            TryGetValueDelegate d = TypeHelpers.CreateTryGetValueDelegate(dictionary.GetType());

            object fooValue;
            bool fooIsFound = d(dictionary, "foo", out fooValue);

            object barValue;
            bool barIsFound = d(dictionary, "bar", out barValue);

            // Assert
            Assert.True(fooIsFound);
            Assert.Equal(42, fooValue);
            Assert.False(barIsFound);
            Assert.Null(barValue);
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:23,代码来源:TypeHelpersTest.cs

示例3: CreatingHashes

 public void CreatingHashes()
 {
     var hash = new Hashtable ();
     Assert.Equals (typeof(System.Collections.Hashtable), hash.GetType ());
     Assert.Equals (FILL_ME_IN, hash.Count);
 }
开发者ID:rhwy,项目名称:CsharpNunitKoans,代码行数:6,代码来源:K060_AboutHashes.cs

示例4: CreatingHashes

 public void CreatingHashes()
 {
     var hash = new Hashtable ();
     Assert.AreEqual(typeof(System.Collections.Hashtable), hash.GetType ());
     Assert.AreEqual(0, hash.Count);
 }
开发者ID:seyuf,项目名称:CsharpNunitKoans,代码行数:6,代码来源:K060_AboutHashes.cs

示例5: ResizeArray

        // --------------------------------------------------------------------------        

        private static void ResizeArray(ref Hashtable[] oldArray, int newSize)
        {
            int oldSize = oldArray.Length;
            System.Type elementType = oldArray.GetType().GetElementType();
            Hashtable[] newArray = (Hashtable[])System.Array.CreateInstance(elementType, newSize);
            int preserveLength = System.Math.Min(oldSize, newSize);
            if (preserveLength > 0)
                System.Array.Copy(oldArray, newArray, preserveLength);
            oldArray = newArray;
        }
开发者ID:ma4u,项目名称:pd-macambira,代码行数:12,代码来源:PureData.cs


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