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
- NodeLabelEditEvent.cs
- GridPattern.cs
- TemplateControlCodeDomTreeGenerator.cs
- ReferenceService.cs
- ProjectionCamera.cs
- MutexSecurity.cs
- ImageList.cs
- HtmlContainerControl.cs
- SequenceDesignerAccessibleObject.cs
- LabelLiteral.cs
- OleDbParameter.cs
- SchemaImporterExtensionsSection.cs
- ExecutionEngineException.cs
- DispatcherBuilder.cs
- HtmlInputSubmit.cs
- RuntimeWrappedException.cs
- SeverityFilter.cs
- BindableAttribute.cs
- DrawingImage.cs
- X509SecurityTokenProvider.cs
- PingReply.cs
- DependencyObject.cs
- SystemSounds.cs
- ArrayList.cs
- SqlPersonalizationProvider.cs
- TableCellsCollectionEditor.cs
- HtmlInputSubmit.cs
- FunctionImportMapping.cs
- NumericPagerField.cs
- SqlFacetAttribute.cs
- PropertyPathWorker.cs
- MembershipSection.cs
- SqlAliaser.cs
- DataGridTableCollection.cs
- MsmqAppDomainProtocolHandler.cs
- NavigationHelper.cs
- LogFlushAsyncResult.cs
- JavaScriptSerializer.cs
- BamlLocalizer.cs
- ListViewItemEventArgs.cs
- BitStack.cs
- URLBuilder.cs
- LayoutSettings.cs
- WsatServiceCertificate.cs
- WindowsMenu.cs
- ShapeTypeface.cs
- newinstructionaction.cs
- StackSpiller.Temps.cs
- AtlasWeb.Designer.cs
- CounterCreationData.cs
- TreeViewItemAutomationPeer.cs
- InvalidEnumArgumentException.cs
- ModelPropertyImpl.cs
- ExceptionValidationRule.cs
- HealthMonitoringSection.cs
- MethodCallTranslator.cs
- smtppermission.cs
- odbcmetadatacolumnnames.cs
- HostedNamedPipeTransportManager.cs
- NoneExcludedImageIndexConverter.cs
- ComponentEvent.cs
- URI.cs
- PreviewKeyDownEventArgs.cs
- SiteMapDataSource.cs
- ListItemCollection.cs
- CLSCompliantAttribute.cs
- MemoryFailPoint.cs
- RegexRunner.cs
- HttpModuleActionCollection.cs
- MSAAEventDispatcher.cs
- RegexGroup.cs
- OutputScopeManager.cs
- IsolatedStorageException.cs
- TemplateParser.cs
- RenderingEventArgs.cs
- ADConnectionHelper.cs
- WSFederationHttpBinding.cs
- FileLoadException.cs
- coordinatorscratchpad.cs
- PointAnimationClockResource.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- QuaternionRotation3D.cs
- ProfileManager.cs
- XamlPathDataSerializer.cs
- PreservationFileReader.cs
- TransformationRules.cs
- BrowserCapabilitiesCodeGenerator.cs
- InlineObject.cs
- StyleSheetComponentEditor.cs
- ElementFactory.cs
- XamlStackWriter.cs
- ConstraintConverter.cs
- RowToParametersTransformer.cs
- DataGridViewColumn.cs
- TextFindEngine.cs
- Span.cs
- MethodToken.cs
- WebAdminConfigurationHelper.cs
- MobileListItemCollection.cs
- BulletChrome.cs