Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / DataBindingCollection.cs / 2 / DataBindingCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.ComponentModel.Design; using System.Data; using System.Web.Util; using System.Security.Permissions; ////// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class DataBindingCollection : ICollection { private EventHandler changedEvent; private Hashtable bindings; private Hashtable removedBindings; ////// public DataBindingCollection() { this.bindings = new Hashtable(StringComparer.OrdinalIgnoreCase); } ////// public int Count { get { return bindings.Count; } } ////// public bool IsReadOnly { get { return false; } } ////// public bool IsSynchronized { get { return false; } } ////// public string[] RemovedBindings { get { int bindingCount = 0; ICollection keys = null; if (removedBindings != null) { keys = removedBindings.Keys; bindingCount = keys.Count; string[] removedNames = new string[bindingCount]; int i = 0; foreach (string s in keys) { removedNames[i++] = s; } removedBindings.Clear(); return removedNames; } else { return new string[0]; } } } ////// private Hashtable RemovedBindingsTable { get { if (removedBindings == null) { removedBindings = new Hashtable(StringComparer.OrdinalIgnoreCase); } return removedBindings; } } ////// public object SyncRoot { get { return this; } } ////// public DataBinding this[string propertyName] { get { object o = bindings[propertyName]; if (o != null) return(DataBinding)o; return null; } } public event EventHandler Changed { add { changedEvent = (EventHandler)Delegate.Combine(changedEvent, value); } remove { changedEvent = (EventHandler)Delegate.Remove(changedEvent, value); } } ////// public void Add(DataBinding binding) { bindings[binding.PropertyName] = binding; RemovedBindingsTable.Remove(binding.PropertyName); OnChanged(); } ////// public bool Contains(string propertyName) { return bindings.Contains(propertyName); } ////// public void Clear() { ICollection keys = bindings.Keys; if ((keys.Count != 0) && (removedBindings == null)) { // ensure the removedBindings hashtable is created Hashtable h = RemovedBindingsTable; } foreach (string s in keys) { removedBindings[s] = String.Empty; } bindings.Clear(); OnChanged(); } ////// public void CopyTo(Array array, int index) { for (IEnumerator e = this.GetEnumerator(); e.MoveNext();) array.SetValue(e.Current, index++); } ////// public IEnumerator GetEnumerator() { return bindings.Values.GetEnumerator(); } private void OnChanged() { if (changedEvent != null) { changedEvent(this, EventArgs.Empty); } } ////// public void Remove(string propertyName) { Remove(propertyName, true); } ////// public void Remove(DataBinding binding) { Remove(binding.PropertyName, true); } ////// public void Remove(string propertyName, bool addToRemovedList) { if (Contains(propertyName)) { bindings.Remove(propertyName); if (addToRemovedList) { RemovedBindingsTable[propertyName] = String.Empty; } OnChanged(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PersonalizationProviderHelper.cs
- TextContainerHelper.cs
- BitmapPalette.cs
- NativeCppClassAttribute.cs
- TransformerConfigurationWizardBase.cs
- Opcode.cs
- WorkflowControlEndpoint.cs
- ListViewItem.cs
- APCustomTypeDescriptor.cs
- AppliesToBehaviorDecisionTable.cs
- SqlDependencyUtils.cs
- SimpleType.cs
- RemotingSurrogateSelector.cs
- TrackingValidationObjectDictionary.cs
- ListItemCollection.cs
- TypefaceMap.cs
- ExpressionEditorAttribute.cs
- UnsafeNativeMethods.cs
- RelationshipFixer.cs
- StylusButtonEventArgs.cs
- WebHttpElement.cs
- UInt64Converter.cs
- DataTemplateKey.cs
- CodeCatchClauseCollection.cs
- TransactionWaitAsyncResult.cs
- SectionVisual.cs
- GridViewRowEventArgs.cs
- MeshGeometry3D.cs
- InternalBufferOverflowException.cs
- ColorAnimation.cs
- ColorConverter.cs
- DataGridItemCollection.cs
- CryptoApi.cs
- ReadOnlyCollectionBuilder.cs
- TextDecoration.cs
- Ticks.cs
- LabelEditEvent.cs
- HashCodeCombiner.cs
- CodeDomConfigurationHandler.cs
- _SslStream.cs
- DeclarationUpdate.cs
- HtmlLink.cs
- ImageConverter.cs
- RowBinding.cs
- TreeNodeEventArgs.cs
- BufferedGraphicsContext.cs
- TreeNodeEventArgs.cs
- HtmlWindowCollection.cs
- XmlWriterSettings.cs
- BaseDataListActionList.cs
- XmlDictionaryReaderQuotas.cs
- RoutingChannelExtension.cs
- SaveFileDialog.cs
- TableDesigner.cs
- SafeArchiveContext.cs
- DateTimeFormatInfoScanner.cs
- FileDialogCustomPlacesCollection.cs
- ColorContext.cs
- WrappedKeySecurityTokenParameters.cs
- WindowsGraphicsWrapper.cs
- WindowsAuthenticationModule.cs
- TabControl.cs
- RewritingPass.cs
- Compensation.cs
- NotImplementedException.cs
- smtpconnection.cs
- DependencySource.cs
- AudioStateChangedEventArgs.cs
- ItemList.cs
- EntityModelBuildProvider.cs
- SystemKeyConverter.cs
- CodeSnippetCompileUnit.cs
- ColumnMapCopier.cs
- DateTimeUtil.cs
- ConnectionStringSettings.cs
- ContainerTracking.cs
- FrameworkReadOnlyPropertyMetadata.cs
- templategroup.cs
- Int32Converter.cs
- RequestCacheManager.cs
- UserUseLicenseDictionaryLoader.cs
- OdbcConnectionFactory.cs
- WasAdminWrapper.cs
- CallbackBehaviorAttribute.cs
- InstanceDataCollectionCollection.cs
- XmlElement.cs
- StorageEntityContainerMapping.cs
- XamlInt32CollectionSerializer.cs
- TypePresenter.xaml.cs
- IncrementalCompileAnalyzer.cs
- XmlReflectionImporter.cs
- XmlSchemaAppInfo.cs
- DataGridViewRowCollection.cs
- SchemaCollectionPreprocessor.cs
- SafeNativeMethodsMilCoreApi.cs
- ExecutedRoutedEventArgs.cs
- HostingEnvironmentException.cs
- InputReport.cs
- Vector3DIndependentAnimationStorage.cs
- MergeFailedEvent.cs