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
- DoubleAverageAggregationOperator.cs
- NotifyParentPropertyAttribute.cs
- WebResourceAttribute.cs
- ReliableReplySessionChannel.cs
- ChunkedMemoryStream.cs
- EncryptionUtility.cs
- GatewayDefinition.cs
- ShapingWorkspace.cs
- WindowsFormsHostPropertyMap.cs
- RunWorkerCompletedEventArgs.cs
- TransformConverter.cs
- TextPenaltyModule.cs
- MenuItemBinding.cs
- CaseStatementSlot.cs
- PerformanceCounterManager.cs
- CacheModeConverter.cs
- RuleCache.cs
- Shape.cs
- DataGridViewCellConverter.cs
- CryptographicAttribute.cs
- DLinqDataModelProvider.cs
- ExecutedRoutedEventArgs.cs
- RoutedPropertyChangedEventArgs.cs
- FontFaceLayoutInfo.cs
- WindowsFormsHelpers.cs
- CodeGroup.cs
- ConfigurationPropertyCollection.cs
- ProxySimple.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- embossbitmapeffect.cs
- DataSourceXmlElementAttribute.cs
- WrapperEqualityComparer.cs
- XsltLibrary.cs
- JoinCqlBlock.cs
- SendAgentStatusRequest.cs
- ConfigurationManagerInternal.cs
- TemplatePartAttribute.cs
- ADConnectionHelper.cs
- BindingCompleteEventArgs.cs
- IncrementalCompileAnalyzer.cs
- StringDictionary.cs
- APCustomTypeDescriptor.cs
- DotExpr.cs
- HttpWriter.cs
- RouteUrlExpressionBuilder.cs
- SystemDiagnosticsSection.cs
- LogExtent.cs
- DataGridViewHeaderCell.cs
- PropertyChangedEventManager.cs
- FixedSOMTextRun.cs
- BamlRecordHelper.cs
- HttpProfileGroupBase.cs
- XhtmlTextWriter.cs
- WebScriptServiceHostFactory.cs
- ReliableRequestSessionChannel.cs
- Viewport3DVisual.cs
- Win32Exception.cs
- HttpModuleAction.cs
- RewritingProcessor.cs
- SinglePhaseEnlistment.cs
- RangeValidator.cs
- ColumnMapTranslator.cs
- ActiveXContainer.cs
- ConvertersCollection.cs
- SerialStream.cs
- ThreadExceptionEvent.cs
- TimeSpanHelper.cs
- SelectionPatternIdentifiers.cs
- Maps.cs
- Msmq4SubqueuePoisonHandler.cs
- ProcessThreadCollection.cs
- NamespaceImport.cs
- WriteableBitmap.cs
- SqlError.cs
- Style.cs
- BrowserDefinition.cs
- CombinedGeometry.cs
- Point4DConverter.cs
- WindowsRichEditRange.cs
- XmlSchemaDocumentation.cs
- AssemblyFilter.cs
- ConfigurationElementCollection.cs
- DelayedRegex.cs
- ItemsControl.cs
- ElementHost.cs
- Attachment.cs
- AspCompat.cs
- UmAlQuraCalendar.cs
- HTTPNotFoundHandler.cs
- RowType.cs
- WebChannelFactory.cs
- SerializationInfo.cs
- CacheModeConverter.cs
- DropSourceBehavior.cs
- LoginDesigner.cs
- MarginCollapsingState.cs
- OptimisticConcurrencyException.cs
- XAMLParseException.cs
- BaseProcessProtocolHandler.cs
- SerializationEventsCache.cs