Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / TypeEnumerableViewSchema.cs / 1 / TypeEnumerableViewSchema.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design { using System; using System.Collections; using System.Diagnostics; using System.Globalization; using System.Reflection; ////// Represents a View's schema based on a strongly typed enumerable. The /// strongly-typed row type is determined based on the indexer property /// of the enumerable. /// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal sealed class TypeEnumerableViewSchema : BaseTypeViewSchema { public TypeEnumerableViewSchema(string viewName, Type type) : base(viewName, type) { Debug.Assert(typeof(IEnumerable).IsAssignableFrom(type), String.Format(CultureInfo.InvariantCulture, "The type '{0}' does not implement System.Collections.IEnumerable.", type.FullName)); } protected override Type GetRowType(Type objectType) { // For arrays we just get the element type if (objectType.IsArray) { Debug.Assert(objectType.HasElementType, "Expected array type to have an ElementType"); Debug.Assert(objectType.GetElementType() != null, "Did not expect array type to have null ElementType"); return objectType.GetElementType(); } // Search for indexer property PropertyInfo[] properties = objectType.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo pi in properties) { ParameterInfo[] indexParams = pi.GetIndexParameters(); if (indexParams.Length > 0) { // We assume that this was the only indexer, so we can immediately stop looking for more // return pi.PropertyType; } } return null; } } } // 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
- Bitmap.cs
- FastPropertyAccessor.cs
- InputProcessorProfiles.cs
- GridEntry.cs
- ReflectTypeDescriptionProvider.cs
- ThemeableAttribute.cs
- SmtpDigestAuthenticationModule.cs
- DataGridViewComboBoxEditingControl.cs
- ComMethodElementCollection.cs
- CompositeCollectionView.cs
- CallbackBehaviorAttribute.cs
- BindingManagerDataErrorEventArgs.cs
- XamlStream.cs
- SqlDependencyListener.cs
- HttpListenerPrefixCollection.cs
- TableItemProviderWrapper.cs
- WebUtil.cs
- CheckedListBox.cs
- BinaryObjectReader.cs
- TextTreeDeleteContentUndoUnit.cs
- SafeNativeMethods.cs
- BuildResultCache.cs
- TextFormatterContext.cs
- InfoCardSymmetricCrypto.cs
- ChtmlTextBoxAdapter.cs
- XmlSerializer.cs
- ScrollChrome.cs
- filewebrequest.cs
- ZipIOCentralDirectoryFileHeader.cs
- ProxyAttribute.cs
- BaseTemplateBuildProvider.cs
- Int64AnimationUsingKeyFrames.cs
- EncryptedKey.cs
- CodeTypeReferenceExpression.cs
- TextEndOfSegment.cs
- ColorTranslator.cs
- MetaDataInfo.cs
- HttpProxyTransportBindingElement.cs
- Message.cs
- FreezableCollection.cs
- Variable.cs
- Int64.cs
- ItemContainerGenerator.cs
- DynamicResourceExtension.cs
- PieceDirectory.cs
- TableSectionStyle.cs
- DropTarget.cs
- XpsSerializationException.cs
- ConfigurationProperty.cs
- ApplicationTrust.cs
- TextBoxView.cs
- HtmlSelect.cs
- Models.cs
- CheckBoxBaseAdapter.cs
- PnrpPermission.cs
- BehaviorEditorPart.cs
- PresentationAppDomainManager.cs
- FileDialog_Vista.cs
- FacetChecker.cs
- XmlLangPropertyAttribute.cs
- DataGridViewRowPrePaintEventArgs.cs
- sapiproxy.cs
- XmlException.cs
- OleDbCommand.cs
- TextRunProperties.cs
- PresentationSource.cs
- oledbmetadatacollectionnames.cs
- DataListAutoFormat.cs
- SoapHeaders.cs
- QueryContext.cs
- DataControlFieldCell.cs
- ClrProviderManifest.cs
- Menu.cs
- SystemThemeKey.cs
- MetadataProperty.cs
- MultiView.cs
- CatalogPartChrome.cs
- AssemblyInfo.cs
- PropertyTabAttribute.cs
- ObjectList.cs
- RegexGroupCollection.cs
- RedirectionProxy.cs
- ViewService.cs
- ExpressionEditorAttribute.cs
- SafeProcessHandle.cs
- ValidatorCollection.cs
- Matrix3DValueSerializer.cs
- RoleGroup.cs
- SingleSelectRootGridEntry.cs
- ExtensionQuery.cs
- DefaultCompensation.cs
- METAHEADER.cs
- Rfc2898DeriveBytes.cs
- XmlName.cs
- AdjustableArrowCap.cs
- TiffBitmapDecoder.cs
- ServiceObjectContainer.cs
- SqlDependencyListener.cs
- SQLByteStorage.cs
- WmlObjectListAdapter.cs