System.ServiceModel.Dispatcher.BaseMessagesFormatter.Create C# (CSharp) Метод

Create() публичный статический Метод

public static Create ( OperationDescription desc ) : BaseMessagesFormatter
desc System.ServiceModel.Description.OperationDescription
Результат BaseMessagesFormatter
		public static BaseMessagesFormatter Create (OperationDescription desc)
		{
			MethodInfo attrProvider = desc.SyncMethod ?? desc.BeginMethod;
			object [] attrs;
#if !NET_2_1
			attrs = attrProvider.GetCustomAttributes (typeof (XmlSerializerFormatAttribute), false);
			if (attrs != null && attrs.Length > 0)
				return new XmlMessagesFormatter (desc, (XmlSerializerFormatAttribute) attrs [0]);
#endif

			attrs = attrProvider.GetCustomAttributes (typeof (DataContractFormatAttribute), false);
			DataContractFormatAttribute dataAttr = null;
			if (attrs != null && attrs.Length > 0)
				dataAttr = (DataContractFormatAttribute) attrs [0];
			return new DataContractMessagesFormatter (desc, dataAttr);
		}

Usage Example

Пример #1
0
        public OperationFormatter(OperationDescription od, bool isRpc, bool isEncoded)
        {
            Validate(od, isRpc, isEncoded);

            impl = BaseMessagesFormatter.Create(od);

            operation_name = od.Name;
        }
All Usage Examples Of System.ServiceModel.Dispatcher.BaseMessagesFormatter::Create