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
- ForwardPositionQuery.cs
- xdrvalidator.cs
- FixedSchema.cs
- SemanticAnalyzer.cs
- UserControl.cs
- CompiledXpathExpr.cs
- ConsumerConnectionPoint.cs
- ReturnEventArgs.cs
- MarkupProperty.cs
- DispatcherObject.cs
- GACMembershipCondition.cs
- Int64KeyFrameCollection.cs
- DbMetaDataColumnNames.cs
- InvalidPrinterException.cs
- RegionData.cs
- VarInfo.cs
- PrinterUnitConvert.cs
- LassoHelper.cs
- XmlDigitalSignatureProcessor.cs
- CacheSection.cs
- Facet.cs
- COM2IDispatchConverter.cs
- ViewGenResults.cs
- SendParametersContent.cs
- HandleCollector.cs
- RemotingConfiguration.cs
- SchemaElementDecl.cs
- ContentTextAutomationPeer.cs
- Roles.cs
- BlurBitmapEffect.cs
- AnonymousIdentificationModule.cs
- ButtonPopupAdapter.cs
- DataViewListener.cs
- UniqueIdentifierService.cs
- MasterPageCodeDomTreeGenerator.cs
- XmlMapping.cs
- ExeContext.cs
- ToolStripContentPanelRenderEventArgs.cs
- SecurityIdentifierElementCollection.cs
- PointUtil.cs
- NotifyParentPropertyAttribute.cs
- AnnotationComponentManager.cs
- TextMetrics.cs
- ErrorInfoXmlDocument.cs
- StateBag.cs
- SystemResourceKey.cs
- QuaternionIndependentAnimationStorage.cs
- RelationshipEndCollection.cs
- OdbcRowUpdatingEvent.cs
- XmlCharCheckingWriter.cs
- SingleSelectRootGridEntry.cs
- ISAPIRuntime.cs
- Camera.cs
- ProcessThreadCollection.cs
- InheritanceContextHelper.cs
- DynamicExpression.cs
- FolderBrowserDialog.cs
- ColumnMapVisitor.cs
- AsyncContentLoadedEventArgs.cs
- InvalidComObjectException.cs
- AuthorizationContext.cs
- FactoryMaker.cs
- EntityContainerEntitySet.cs
- CompositeActivityValidator.cs
- XmlReturnWriter.cs
- Cursors.cs
- CompilerError.cs
- PropertyMetadata.cs
- SmtpReplyReader.cs
- SqlTriggerContext.cs
- MediaContext.cs
- PropertyBuilder.cs
- ByteStreamGeometryContext.cs
- DesignConnectionCollection.cs
- UnsafeNativeMethods.cs
- Pair.cs
- StreamResourceInfo.cs
- CacheHelper.cs
- ApplicationSettingsBase.cs
- TransactionManager.cs
- DictionaryManager.cs
- XmlSchemaValidator.cs
- PartialCachingControl.cs
- BamlRecordHelper.cs
- TreeViewItemAutomationPeer.cs
- RadialGradientBrush.cs
- PersistenceContextEnlistment.cs
- DateTimeFormatInfo.cs
- SharedConnectionWorkflowTransactionService.cs
- SHA1.cs
- SecureEnvironment.cs
- AlphabeticalEnumConverter.cs
- PrimitiveDataContract.cs
- WmfPlaceableFileHeader.cs
- XamlTypeMapperSchemaContext.cs
- XpsResourcePolicy.cs
- AllMembershipCondition.cs
- AnyReturnReader.cs
- OdbcFactory.cs
- ThemeInfoAttribute.cs