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
- XmlCharType.cs
- Sequence.cs
- NetPeerTcpBinding.cs
- Ops.cs
- Expressions.cs
- SqlReferenceCollection.cs
- RegexCharClass.cs
- SeverityFilter.cs
- ResponseBodyWriter.cs
- ZeroOpNode.cs
- TextRangeAdaptor.cs
- PaperSize.cs
- ContainerParagraph.cs
- updateconfighost.cs
- ToolStripDropDownClosingEventArgs.cs
- CustomErrorCollection.cs
- SafeFileMappingHandle.cs
- DiagnosticTraceSource.cs
- DataContractJsonSerializer.cs
- DateTimePicker.cs
- GACIdentityPermission.cs
- UriScheme.cs
- XPathScanner.cs
- MetricEntry.cs
- ToolStripRendererSwitcher.cs
- ExceptionUtil.cs
- BoolExpression.cs
- ItemsPanelTemplate.cs
- ApplicationCommands.cs
- SemaphoreSecurity.cs
- DataList.cs
- PersistencePipeline.cs
- ISAPIRuntime.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ExpandSegmentCollection.cs
- DataMemberConverter.cs
- MobileFormsAuthentication.cs
- ZipIOLocalFileBlock.cs
- FontStretches.cs
- MexNamedPipeBindingCollectionElement.cs
- SimpleParser.cs
- KerberosTicketHashIdentifierClause.cs
- AgileSafeNativeMemoryHandle.cs
- HttpCapabilitiesBase.cs
- ISAPIWorkerRequest.cs
- OlePropertyStructs.cs
- FileSystemWatcher.cs
- UrlPath.cs
- InfoCardKeyedHashAlgorithm.cs
- Part.cs
- VisualTreeUtils.cs
- CallbackHandler.cs
- IisTraceWebEventProvider.cs
- ListViewPagedDataSource.cs
- NavigatorOutput.cs
- CurrentChangingEventManager.cs
- xsdvalidator.cs
- SpellerHighlightLayer.cs
- TypeSystem.cs
- BitmapEditor.cs
- RIPEMD160.cs
- OdbcParameterCollection.cs
- BitmapEffectInput.cs
- ListViewTableCell.cs
- SQLStringStorage.cs
- SqlCommandSet.cs
- BinaryEditor.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- EventLogInternal.cs
- MachineKeyValidationConverter.cs
- SafeFileMappingHandle.cs
- processwaithandle.cs
- AuthenticatingEventArgs.cs
- BookmarkScopeHandle.cs
- ResourceDictionary.cs
- CqlErrorHelper.cs
- CompModHelpers.cs
- MailWebEventProvider.cs
- IntegerCollectionEditor.cs
- SQLInt16Storage.cs
- GridViewDeletedEventArgs.cs
- CodeMemberMethod.cs
- EtwTrace.cs
- AssemblyCacheEntry.cs
- ApplicationContext.cs
- DesignerAdapterAttribute.cs
- ThemeConfigurationDialog.cs
- MeshGeometry3D.cs
- HtmlButton.cs
- ObjectCloneHelper.cs
- AutomationEventArgs.cs
- SourceChangedEventArgs.cs
- EdmSchemaError.cs
- CounterCreationDataCollection.cs
- TypeListConverter.cs
- DataKeyPropertyAttribute.cs
- ADRole.cs
- LogAppendAsyncResult.cs
- ListenerConfig.cs
- Semaphore.cs