Code:
/ DotNET / DotNET / 8.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
- DataGridViewTextBoxColumn.cs
- ChtmlCommandAdapter.cs
- InvalidDocumentContentsException.cs
- RemoteWebConfigurationHostStream.cs
- ConstructorExpr.cs
- VisualTarget.cs
- TaiwanCalendar.cs
- JoinTreeSlot.cs
- TextEndOfLine.cs
- PieceNameHelper.cs
- CardSpaceShim.cs
- UriSchemeKeyedCollection.cs
- XPathAxisIterator.cs
- CustomValidator.cs
- ZoomingMessageFilter.cs
- ObjectMaterializedEventArgs.cs
- TextModifierScope.cs
- WhitespaceRule.cs
- UnsafeNativeMethods.cs
- PortCache.cs
- HGlobalSafeHandle.cs
- ItemList.cs
- UInt32.cs
- datacache.cs
- HierarchicalDataSourceIDConverter.cs
- FontEmbeddingManager.cs
- MetafileEditor.cs
- StringCollection.cs
- XmlSchemas.cs
- WebReferencesBuildProvider.cs
- DataBindingExpressionBuilder.cs
- EventlogProvider.cs
- RouteParametersHelper.cs
- SqlCommandBuilder.cs
- SqlProvider.cs
- DateTimeFormatInfoScanner.cs
- Italic.cs
- SpellCheck.cs
- DateRangeEvent.cs
- MeasurementDCInfo.cs
- XmlSchemaIdentityConstraint.cs
- PaintEvent.cs
- CustomError.cs
- MessageBuilder.cs
- KeyValuePair.cs
- RefExpr.cs
- SchemaImporterExtensionElement.cs
- MarkupCompilePass2.cs
- SvcMapFileLoader.cs
- LogicalExpr.cs
- WebRequestModulesSection.cs
- RuleSetCollection.cs
- Application.cs
- SignatureToken.cs
- IdnElement.cs
- WpfMemberInvoker.cs
- KerberosRequestorSecurityToken.cs
- PropertyContainer.cs
- VirtualDirectoryMappingCollection.cs
- SystemInfo.cs
- MetadataItemCollectionFactory.cs
- IMembershipProvider.cs
- PolicyAssertionCollection.cs
- InstancePersistenceCommand.cs
- BitmapFrame.cs
- XsltSettings.cs
- OdbcCommandBuilder.cs
- XmlFormatWriterGenerator.cs
- UriTemplateMatch.cs
- MessageQueueCriteria.cs
- BitmapEffectInput.cs
- EtwTrace.cs
- BindingCollection.cs
- AsyncDataRequest.cs
- TextWriterEngine.cs
- TransformerConfigurationWizardBase.cs
- ISO2022Encoding.cs
- XmlDocumentFragment.cs
- Trace.cs
- Viewport3DVisual.cs
- SystemResources.cs
- EnumerableRowCollectionExtensions.cs
- webbrowsersite.cs
- OleCmdHelper.cs
- EventEntry.cs
- MethodBody.cs
- XmlWellformedWriterHelpers.cs
- TableChangeProcessor.cs
- ZipPackage.cs
- CharacterString.cs
- ZipPackagePart.cs
- SqlReorderer.cs
- ParsedAttributeCollection.cs
- UiaCoreApi.cs
- ExtenderProvidedPropertyAttribute.cs
- XmlDataSourceNodeDescriptor.cs
- UndoEngine.cs
- FrameDimension.cs
- TextUtf8RawTextWriter.cs
- ContractUtils.cs