Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataWeb / Server / System / Data / Services / MimeTypeAttribute.cs / 1 / MimeTypeAttribute.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a class to decorate properties and custom service // operations with a MIME type. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { using System; using System.Diagnostics; using System.Reflection; using System.Linq; ////// Use this attribute on a DataService service operation method /// or a data object property to indicate than the type returned is /// of a specific MIME type. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class MimeTypeAttribute : Attribute { ///Name of the attributed method or property. private readonly string memberName; ///MIME type for the attributed method or property. private readonly string mimeType; ////// Initializes a new /// Name of the attributed method or property. /// MIME type for the attributed method or property. public MimeTypeAttribute(string memberName, string mimeType) { this.memberName = memberName; this.mimeType = mimeType; } ///instance with /// the specified MIME type. /// Name of the attributed method or property. public string MemberName { get { return this.memberName; } } ////// MIME type for the attributed method or property. /// public string MimeType { get { return this.mimeType; } } ////// Gets the MIME type declared on the specified /// Member to check. ///. /// /// The MIME type declared on the specified internal static string GetMemberMimeType(MemberInfo member) { Debug.Assert(member != null, "member != null"); return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true) .Cast; null /// if no attribute is declared. /// () .Where (o => o.MemberName == member.Name) .Select (o => o.MimeType) .SingleOrDefault(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a class to decorate properties and custom service // operations with a MIME type. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { using System; using System.Diagnostics; using System.Reflection; using System.Linq; ////// Use this attribute on a DataService service operation method /// or a data object property to indicate than the type returned is /// of a specific MIME type. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class MimeTypeAttribute : Attribute { ///Name of the attributed method or property. private readonly string memberName; ///MIME type for the attributed method or property. private readonly string mimeType; ////// Initializes a new /// Name of the attributed method or property. /// MIME type for the attributed method or property. public MimeTypeAttribute(string memberName, string mimeType) { this.memberName = memberName; this.mimeType = mimeType; } ///instance with /// the specified MIME type. /// Name of the attributed method or property. public string MemberName { get { return this.memberName; } } ////// MIME type for the attributed method or property. /// public string MimeType { get { return this.mimeType; } } ////// Gets the MIME type declared on the specified /// Member to check. ///. /// /// The MIME type declared on the specified internal static string GetMemberMimeType(MemberInfo member) { Debug.Assert(member != null, "member != null"); return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true) .Cast; null /// if no attribute is declared. /// () .Where (o => o.MemberName == member.Name) .Select (o => o.MimeType) .SingleOrDefault(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StorageRoot.cs
- DataGridViewCellPaintingEventArgs.cs
- XPathAxisIterator.cs
- BasicExpandProvider.cs
- Stream.cs
- WinCategoryAttribute.cs
- PropertyGrid.cs
- ToolStripComboBox.cs
- IisNotInstalledException.cs
- SchemaImporterExtensionElementCollection.cs
- DataGridViewColumnStateChangedEventArgs.cs
- FontDialog.cs
- WebSysDescriptionAttribute.cs
- ResourcesBuildProvider.cs
- WebContext.cs
- ToolStripPanelCell.cs
- FixedBufferAttribute.cs
- _RequestCacheProtocol.cs
- OleDbDataReader.cs
- MatrixKeyFrameCollection.cs
- SHA1Managed.cs
- BitVector32.cs
- CodeAssignStatement.cs
- TransactionChannelListener.cs
- WindowsIPAddress.cs
- ToolstripProfessionalRenderer.cs
- AsyncMethodInvoker.cs
- XmlSchemaAny.cs
- ChtmlFormAdapter.cs
- Stackframe.cs
- WindowsFormsSectionHandler.cs
- CodeCommentStatement.cs
- CLSCompliantAttribute.cs
- TraceContext.cs
- CommandValueSerializer.cs
- DynamicActivityTypeDescriptor.cs
- HttpAsyncResult.cs
- PrimitiveXmlSerializers.cs
- DataGrid.cs
- XmlUtf8RawTextWriter.cs
- DbFunctionCommandTree.cs
- TextSchema.cs
- ActivityTypeDesigner.xaml.cs
- OperationParameterInfo.cs
- SqlProcedureAttribute.cs
- InputLanguageEventArgs.cs
- ObjectItemNoOpAssemblyLoader.cs
- KeyNotFoundException.cs
- WebContext.cs
- CalendarDesigner.cs
- MethodImplAttribute.cs
- URLIdentityPermission.cs
- ItemsChangedEventArgs.cs
- DefaultMergeHelper.cs
- TiffBitmapDecoder.cs
- RuntimeArgumentHandle.cs
- Mappings.cs
- _KerberosClient.cs
- Int16Storage.cs
- Parsers.cs
- DesignerAdRotatorAdapter.cs
- CloudCollection.cs
- IndentedWriter.cs
- ScriptRegistrationManager.cs
- X509SecurityTokenAuthenticator.cs
- Parsers.cs
- DynamicArgumentDesigner.xaml.cs
- SelfIssuedSamlTokenFactory.cs
- StateBag.cs
- ErrorWebPart.cs
- SymbolEqualComparer.cs
- HitTestWithGeometryDrawingContextWalker.cs
- CompilationLock.cs
- CatalogZone.cs
- Stacktrace.cs
- FlowPosition.cs
- IndexingContentUnit.cs
- NavigationProgressEventArgs.cs
- securitycriticaldataformultiplegetandset.cs
- TemplateInstanceAttribute.cs
- CaseCqlBlock.cs
- CommandSet.cs
- BuildResult.cs
- PerspectiveCamera.cs
- BehaviorEditorPart.cs
- CharUnicodeInfo.cs
- AssemblyCache.cs
- StyleXamlParser.cs
- DataGridTextBox.cs
- WindowsGraphicsWrapper.cs
- TreeViewEvent.cs
- UnsafeNativeMethods.cs
- RawAppCommandInputReport.cs
- Comparer.cs
- HttpServerVarsCollection.cs
- CustomError.cs
- srgsitem.cs
- CriticalHandle.cs
- WindowsListViewSubItem.cs
- WebResponse.cs