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
- ManagementException.cs
- CultureInfoConverter.cs
- X509Certificate2.cs
- IpcServerChannel.cs
- TdsParserStateObject.cs
- CodeDelegateInvokeExpression.cs
- ActivityExecutor.cs
- ModelProperty.cs
- DesignerActionList.cs
- OutputScopeManager.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- Profiler.cs
- TraceFilter.cs
- DependentList.cs
- Walker.cs
- QueryInterceptorAttribute.cs
- SQLCharsStorage.cs
- EventlogProvider.cs
- GregorianCalendarHelper.cs
- UiaCoreProviderApi.cs
- Cursor.cs
- ConfigXmlText.cs
- UriExt.cs
- XmlSchemaFacet.cs
- RegistryConfigurationProvider.cs
- IgnoreFlushAndCloseStream.cs
- PersonalizablePropertyEntry.cs
- Ray3DHitTestResult.cs
- TextOptions.cs
- TargetConverter.cs
- SchemaCollectionPreprocessor.cs
- MailWriter.cs
- AdvancedBindingEditor.cs
- EnterpriseServicesHelper.cs
- SerializationEventsCache.cs
- RSAOAEPKeyExchangeFormatter.cs
- Add.cs
- WindowsAuthenticationModule.cs
- TreeNodeMouseHoverEvent.cs
- ParamArrayAttribute.cs
- AssemblyInfo.cs
- ChtmlPageAdapter.cs
- COSERVERINFO.cs
- Byte.cs
- TakeOrSkipQueryOperator.cs
- StrongName.cs
- CannotUnloadAppDomainException.cs
- SeparatorAutomationPeer.cs
- FormsAuthenticationUser.cs
- FrugalMap.cs
- WebPart.cs
- XomlCompilerHelpers.cs
- WebPartZoneBase.cs
- SafeNativeMethods.cs
- BridgeDataRecord.cs
- DesignerSerializationOptionsAttribute.cs
- InvalidProgramException.cs
- ItemCheckEvent.cs
- WindowsTooltip.cs
- FilterableAttribute.cs
- DesignerVerbCollection.cs
- MetadataException.cs
- SqlDataSourceSelectingEventArgs.cs
- MaskDescriptor.cs
- XmlSchemaAttribute.cs
- TransformCollection.cs
- DuplicateWaitObjectException.cs
- Int32Rect.cs
- EnterpriseServicesHelper.cs
- IPEndPoint.cs
- WeakEventManager.cs
- UnauthorizedWebPart.cs
- AuthorizationSection.cs
- PointLightBase.cs
- ISAPIWorkerRequest.cs
- ObjectQueryExecutionPlan.cs
- CorrelationTokenInvalidatedHandler.cs
- PipelineModuleStepContainer.cs
- SimpleTypesSurrogate.cs
- AnimatedTypeHelpers.cs
- DataFieldConverter.cs
- DetailsViewRow.cs
- StructuralType.cs
- HtmlAnchor.cs
- GlyphingCache.cs
- SmiEventSink_DeferedProcessing.cs
- SystemGatewayIPAddressInformation.cs
- GridSplitterAutomationPeer.cs
- Bold.cs
- SqlDataSourceRefreshSchemaForm.cs
- FileAccessException.cs
- DBCommand.cs
- DataSourceBooleanViewSchemaConverter.cs
- SortExpressionBuilder.cs
- WebAdminConfigurationHelper.cs
- WindowsHyperlink.cs
- DataBindingHandlerAttribute.cs
- ExtenderProvidedPropertyAttribute.cs
- TypeGenericEnumerableViewSchema.cs
- WebBrowserNavigatingEventHandler.cs