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


C# DataDictionary.Set方法代码示例

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


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

示例1: Get_DifferentKeyAdded_ReturnsNull

        public void Get_DifferentKeyAdded_ReturnsNull()
        {
            var dd = new DataDictionary ();

            dd.Set ("blizbar", "baz");

            string res = dd.Get ("foobar");
            Assert.IsNull (res);
        }
开发者ID:vbatz258,项目名称:manos,代码行数:9,代码来源:DataDictionaryTest.cs

示例2: Get_NameSetInChild_ReturnsItem

        public void Get_NameSetInChild_ReturnsItem()
        {
            var dd = new DataDictionary ();
            var child = new DataDictionary ();

            dd.Children.Add (child);
            child.Set ("foobar", "baz");

            string res = dd.Get ("foobar");
            Assert.AreEqual ("baz", res);
        }
开发者ID:KevinT,项目名称:manos,代码行数:11,代码来源:DataDictionaryTest.cs

示例3: Get_MultipleChildrenWithKey_ReturnsFirstChildAdded

        public void Get_MultipleChildrenWithKey_ReturnsFirstChildAdded()
        {
            var dd = new DataDictionary ();
            var child = new DataDictionary ();

            dd.Children.Add (child);
            child.Set ("foobar", "baz");

            child = new DataDictionary ();
            dd.Children.Add (child);
            child.Set ("foobar", "blahh");

            child = new DataDictionary ();
            dd.Children.Add (child);
            child.Set ("foobar", "bork");

            string res = dd.Get ("foobar");
            Assert.AreEqual ("baz", res);
        }
开发者ID:vbatz258,项目名称:manos,代码行数:19,代码来源:DataDictionaryTest.cs

示例4: Get_NameSet_ReturnsItem

        public void Get_NameSet_ReturnsItem()
        {
            var dd = new DataDictionary ();

            dd.Set ("foobar", "baz");

            string res = dd.Get ("foobar");
            Assert.AreEqual ("baz", res);
        }
开发者ID:vbatz258,项目名称:manos,代码行数:9,代码来源:DataDictionaryTest.cs

示例5: AddUriData

        private void AddUriData(Match m, DataDictionary uri_data)
        {
            string [] groups = regex.GetGroupNames ();
            foreach (string gn in groups) {
                Group g = m.Groups [gn];

                //
                // Unfortunately regex matching creates named groups with
                // the match index as their name, we want to filter all of
                // these guys out.
                //
                int dummy;
                if (Int32.TryParse (gn, out dummy))
                    continue;
                uri_data.Set (gn, g.Value);
            }
        }
开发者ID:imintsystems,项目名称:Waser,代码行数:17,代码来源:RegexMatchOperation.cs

示例6: FromHeader

        public static DataDictionary FromHeader(string header)
        {
            int eq_idx = -1;
            int key_idx = 0;
            DataDictionary dict = new DataDictionary ();

            for (int i = 0; i < header.Length; i++) {
                if (header [i] == ';') {
                    if (eq_idx == -1)
                        continue;
                    string key = header.Substring (key_idx, eq_idx - key_idx);
                    string value = header.Substring (eq_idx + 1, i - eq_idx - 1);

                    dict.Set (key.Trim (), value.Trim ());

                    key_idx = i + 1;
                    eq_idx = -1;
                    continue;
                }

                if (header [i] == '=')
                    eq_idx = i;
            }

            if (eq_idx != -1) {
                string key = header.Substring (key_idx, eq_idx - key_idx);
                string value = header.Substring (eq_idx + 1);

                dict.Set (key.Trim (), value.Trim ());
            }

            return dict;
        }
开发者ID:imintsystems,项目名称:Waser,代码行数:33,代码来源:Cookie.cs

示例7: ParseUrlEncodedData

        internal static void ParseUrlEncodedData(string data, Encoding encoding, DataDictionary result)
        {
            if (data.Length == 0)
                return;

            string decoded = HtmlDecode (data);
            int decodedLength = decoded.Length;
            int namePos = 0;
            bool first = true;
            while (namePos <= decodedLength) {
                int valuePos = -1, valueEnd = -1;
                for (int q = namePos; q < decodedLength; q++) {
                    if (valuePos == -1 && decoded [q] == '=') {
                        valuePos = q + 1;
                    } else if (decoded [q] == '&') {
                        valueEnd = q;
                        break;
                    }
                }

                if (first) {
                    first = false;
                    if (decoded [namePos] == '?')
                        namePos++;
                }

                string name, value;
                if (valuePos == -1) {
                    name = null;
                    valuePos = namePos;
                } else {
                    name = UrlDecode (decoded.Substring (namePos, valuePos - namePos - 1), encoding);
                }
                if (valueEnd < 0) {
                    namePos = -1;
                    valueEnd = decoded.Length;
                } else {
                    namePos = valueEnd + 1;
                }
                value = UrlDecode (decoded.Substring (valuePos, valueEnd - valuePos), encoding);

                if (name == null) {
                   name = value;
                   value = String.Empty;
                }
                result.Set (name, value);
                if (namePos == -1)
                    break;
            }
        }
开发者ID:imintsystems,项目名称:Waser,代码行数:50,代码来源:Utility.cs


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