//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Messaging.Reflection { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Validation; /// /// Allows a custom class or struct to be serializable between itself and a string representation. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)] internal sealed class DefaultEncoderAttribute : Attribute { /// /// Initializes a new instance of the class. /// /// The implementing type to use for serializing this type. public DefaultEncoderAttribute(Type converterType) { Requires.NotNull(converterType, "converterType"); Requires.That(typeof(IMessagePartEncoder).IsAssignableFrom(converterType), "Argument must be a type that implements {0}.", typeof(IMessagePartEncoder).Name); this.Encoder = (IMessagePartEncoder)Activator.CreateInstance(converterType); } /// /// Gets the default encoder to use for the declaring class. /// public IMessagePartEncoder Encoder { get; private set; } } }