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


C# StateBag.Add方法代码示例

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


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

示例1: DeserializeStateBag

        public static StateBag DeserializeStateBag(SerializationReader reader)
        {
            var flags = reader.ReadOptimizedBitVector32();
            var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);

            if (flags[StateBagHasDirtyEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

            // ReSharper disable PossibleNullReferenceException
                    stateBag.Add(key, value).IsDirty = true;
            // ReSharper restore PossibleNullReferenceException
                }
            }

            if (flags[StateBagHasCleanEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

                    stateBag.Add(key, value);
                }
            }
            return stateBag;
        }
开发者ID:bbqchickenrobot,项目名称:FastSerializer,代码行数:34,代码来源:WebFastSerializationHelper.cs

示例2: WebPartVerb

		public WebPartVerb (string id, WebPartEventHandler serverClickHandler, string clientClickHandler) {
			this.id = id;
			this.serverClickHandler = serverClickHandler;
			this.clientClickHandler = clientClickHandler;
			stateBag = new StateBag ();
			stateBag.Add ("serverClickHandler", serverClickHandler);
			stateBag.Add ("clientClickHandler", clientClickHandler);
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:WebPartVerb.cs

示例3: WebPartVerb

		public WebPartVerb (string clientHandler)
		{
			this.clientClickHandler = clientHandler;
			stateBag = new StateBag ();
			stateBag.Add ("clientClickHandler", clientHandler);

		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:WebPartVerb.cs

示例4: NextTempRecId

        internal static int NextTempRecId(StateBag viewState)
        {
            if (viewState["TempRecId"] != null)
            {
                int RecId = Convert.ToInt32(viewState["TempRecId"]) + 1;

                viewState.Add("TempRecId", RecId);
                return RecId;
            }
            else
            {
                viewState.Add("TempRecId", 1);
                return 1;
            }
        }
开发者ID:javierlov,项目名称:PautasElectronica,代码行数:15,代码来源:ProcesoHelper.cs

示例5: IDictionary_Deny_Unrestricted

		public void IDictionary_Deny_Unrestricted ()
		{
			IDictionary d = new StateBag ();
			d.Add ("key", "value");
			Assert.IsTrue (d.Contains ("key"), "Contains");
			Assert.AreEqual (1, d.Count, "Count");
			d.Remove ("key");
			d["key"] = "value";
			Assert.AreEqual ("value", d["key"], "this[string]");
			d.Clear ();
			Assert.IsFalse (d.IsFixedSize, "IsFixedSize");
			Assert.IsFalse (d.IsReadOnly, "IsReadOnly");

			ICollection c = (d as ICollection);
			Assert.IsFalse (c.IsSynchronized, "IsSynchronized");
			Assert.IsNotNull (c.SyncRoot, "SyncRoot");
		}
开发者ID:nobled,项目名称:mono,代码行数:17,代码来源:StateBagCas.cs

示例6: Deny_Unrestricted

		public void Deny_Unrestricted ()
		{
			StateBag bag = new StateBag (true);
			Assert.IsNotNull (bag.Add ("key", "value"), "Add");
			Assert.AreEqual (1, bag.Count, "Count");
			Assert.IsNotNull (bag.GetEnumerator (), "GetEnumerator");
			bag.SetItemDirty ("key", true);
			Assert.IsTrue (bag.IsItemDirty ("key"), "IsItemDirty");
			bag.Remove ("key");

			bag.Clear ();
			bag["key"] = "value";
			Assert.IsNotNull (bag["key"], "this[string]");
			Assert.IsNotNull (bag.Keys, "Keys");
			Assert.IsNotNull (bag.Values, "Values");
			bag.SetDirty (true);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:17,代码来源:StateBagCas.cs

示例7: DeserializeStateBag

		public static StateBag DeserializeStateBag(SerializationReader reader)
		{
			BitVector32 flags = reader.ReadOptimizedBitVector32();
			StateBag stateBag = new StateBag(flags[StateBagIsIgnoreCase]);

			if (flags[StateBagHasDirtyEntries])
			{
				int count = reader.ReadOptimizedInt32();
				for(int i = 0; i < count; i++)
				{
					string key = reader.ReadOptimizedString();
					object value = reader.ReadObject();
					stateBag.Add(key, value).IsDirty = true;
				}
			}

			if (flags[StateBagHasCleanEntries]) 
			{
				int count = reader.ReadOptimizedInt32();
				for(int i = 0; i < count; i++)
				{
					string key = reader.ReadOptimizedString();
					object value = reader.ReadObject();
					stateBag.Add(key, value);
				}
			}
			return stateBag;
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:28,代码来源:WebFastSerializationHelper.cs

示例8: WriteOption

        /// <summary>
        /// Writes the option.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="writer">The writer.</param>
        private void WriteOption(ExtendedListItem item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("option");
            if (item.Selected)
            {
                if (_selected)
                {
                    this.VerifyMultiSelect();
                }
                _selected = true;
                writer.WriteAttribute("selected", "selected");
            }

            if (!string.IsNullOrEmpty(item.CssClass))
                writer.WriteAttribute("class", item.CssClass);

            writer.WriteAttribute("value", item.Value, true);

            if (item.Attributes.Count > 0)
            {
                StateBag bag = new StateBag();
                foreach (string attrKey in item.Attributes.Keys)
                {
                    if (attrKey.IndexOf(ExtendedListItem._attrPrefix) == -1)
                        bag.Add(attrKey, item.Attributes[attrKey]);
                }

                System.Web.UI.AttributeCollection coll = new System.Web.UI.AttributeCollection(bag);

                coll.Render(writer);
            }

            if (this.Page != null)
            {
                this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value);
            }

            writer.Write('>');
            HttpUtility.HtmlEncode(item.Text, writer);
            writer.WriteEndTag("option");
            writer.WriteLine();
        }
开发者ID:fmendes,项目名称:RegisterJavascript,代码行数:47,代码来源:ExtendedDropDownList.cs


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