当前位置: 首页>>代码示例>>C#>>正文


C# SerializationFormat类代码示例

本文整理汇总了C#中SerializationFormat的典型用法代码示例。如果您正苦于以下问题:C# SerializationFormat类的具体用法?C# SerializationFormat怎么用?C# SerializationFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SerializationFormat类属于命名空间,在下文中一共展示了SerializationFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCurrent

 public static ISerializer GetCurrent(SerializationFormat format)
 {            
     var serializers = Container.GetAll<ISerializer>();
     return (from s in serializers
             where s.Format == format
             select s).FirstOrDefault();
 }
开发者ID:Narinyir,项目名称:caching,代码行数:7,代码来源:Serializer.cs

示例2: ToClaim

        public Claim ToClaim(SerializationFormat serializationFormat = SerializationFormat.Json)
        {
            return new Claim(ClaimTypes.GroupSid, Sid);

            //var serialized = serializationFormat == SerializationFormat.Json
            //    ? this.ToJson()
            //    : this.ToXml();
            //return new Claim(LDAPClaimTypes.ActiveDirectoryGroup, serialized);
        }
开发者ID:blinds52,项目名称:Owin.Security.ActiveDirectoryLDAP,代码行数:9,代码来源:Group.cs

示例3: RESTDataClient

 /// <summary>
 /// Creates a new instance of RESTDataClient.
 /// </summary>
 /// <param name="serviceUrl">The url endpoint of the service to send data to.</param>
 /// <param name="timeout">A timeout for all requests.</param>
 /// <param name="compress">Whether to compress data before sending. Only applies when posting JSON or XML, not with HttpQueryString mode.</param>
 /// <param name="serializationFormat">The version number to send to the server.</param>
 /// <param name="version">The version number to send to the server.</param>
 public RESTDataClient(Uri serviceUrl, int timeout, bool compress, SerializationFormat serializationFormat, int version)
 {
     Version = version;
     ServiceUrl = serviceUrl;
     Timeout = TimeSpan.FromSeconds(timeout);
     Compress = compress;
     SerializationFormat = serializationFormat;
     AdditionalHttpHeaders = new Dictionary<string, string>();
 }
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:17,代码来源:RESTDataClient.cs

示例4: SerializedValue

        public SerializedValue([NotNull] string assemblyQualifiedName)
        {
            if (assemblyQualifiedName == null)
            {
                throw new ArgumentNullException("assemblyQualifiedName");
            }

            _assemblyQualifiedName = assemblyQualifiedName;
            _format = SerializationFormat.Null;
        }
开发者ID:JackTheRipper42,项目名称:Binding,代码行数:10,代码来源:SerializedValue.cs

示例5: HttpCacheRequestHandler

        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName = behaviors.ScopeName;
            credentials = behaviors.Credentials;
            knownTypes = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
        }
开发者ID:dkmehta,项目名称:SyncWinRT,代码行数:13,代码来源:HttpCacheRequestHandlerAsync.cs

示例6: JsonResult

		public JsonResult(object data, string contentType,
			Encoding contentEncoding, SerializationFormat format, 
			IEnumerable<JavaScriptConverter> converters)
		{
			_converters = new List<JavaScriptConverter>(
				converters ?? Enumerable.Empty<JavaScriptConverter>());

			_data = data;
			_contentType = contentType;
			_contentEncoding = contentEncoding;
			_format = format;
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:12,代码来源:JsonResult.cs

示例7: HttpCacheRequestHandler

        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName = behaviors.ScopeName;
            credentials = behaviors.Credentials;
            knownTypes = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
            customHeaders = new Dictionary<string, string>(behaviors.CustomHeadersInternal);
            automaticDecompression = behaviors.AutomaticDecompression;
            this.CookieContainer = behaviors.CookieContainer;
        }
开发者ID:erpframework,项目名称:SyncWinRT,代码行数:16,代码来源:HttpCacheRequestHandlerAsync.cs

示例8: Run

 public void Run(AmfFile file, out string name, out SerializationFormat format)
 {
     // Case for "save to file". Fenoxo only serializes ones object and there is no header.
     if (_reader.PeekChar() == 0x0A)
     {
         format = SerializationFormat.Exported;
         ReadPlainDataFile(file, out name);
     }
     // Case for "save to slot". Real AMF3 file with a proper header.
     else
     {
         format = SerializationFormat.Slot;
         ReadStandardFile(file, out name);
     }
 }
开发者ID:Belgrath,项目名称:CoCEd,代码行数:15,代码来源:AmfReader.cs

示例9: SerializeSystemBoolean

 public static Stream SerializeSystemBoolean(bool obj, SerializationFormat serializationFormat, WebMessageFormat webMessageFormat)
 {
     if (IsXml(serializationFormat, webMessageFormat))
     {
         var root = new XElement(XName.Get("Boolean"));
         var xDocument = new XDocument(root);
         root.Add(XmlConvert.ToString(obj));
         var stream = GetStream(xDocument);
         return stream;
     }
     else
     {
         return GetStream(obj.ToJsonString());
     }
 }
开发者ID:nguyenkien,项目名称:api,代码行数:15,代码来源:SerializationHelperBase.cs

示例10: Get

 public ISerializer Get(SerializationFormat format)
 {
     switch (format)
     {
         case SerializationFormat.None:
             return this.Null;
         case SerializationFormat.Json:
             return this.Json;
         case SerializationFormat.Xml:
             return this.Xml;
         case SerializationFormat.Binary:
             return this.Binary;
         case SerializationFormat.Null:
             throw new Exception("You must specify a valid SerializationFormat");
         default:
             throw new Exception(string.Format("There is no serializer with format '{0}'", format));
     }
 }
开发者ID:Sunzhuokai,项目名称:caching,代码行数:18,代码来源:Serializer.cs

示例11: SerializeSystemBooleanArray

 public static Stream SerializeSystemBooleanArray(bool[] objs, SerializationFormat serializationFormat, WebMessageFormat webMessageFormat)
 {
     if (IsXml(serializationFormat, webMessageFormat))
     {
         var root = new XElement(XName.Get("BooleanArray"));
         var xDocument = new XDocument(root);
         foreach (var obj in objs)
         {
             var child = new XElement(XName.Get("Boolean"));
             child.Add(XmlConvert.ToString(obj));
         }
         var stream = GetStream(xDocument);
         return stream;
     }
     else
     {
         return GetStream(objs.ToJsonString());
     }
 }
开发者ID:nguyenkien,项目名称:api,代码行数:19,代码来源:SerializationHelperBase.cs

示例12: Run

        public void Run(AmfFile file, string newName, SerializationFormat format)
        {
            switch (format)
            {
                case SerializationFormat.Slot:
                    WriteStandardFile(file, newName);
                    break;

                case SerializationFormat.Exported:
                    WritePlainDataFile(file);
                    break;

                default:
                    throw new NotImplementedException();
            }

            // Flush
            _writer.Flush();
        }
开发者ID:Belgrath,项目名称:CoCEd,代码行数:19,代码来源:AmfWriter.cs

示例13: CacheControllerBehavior

 internal CacheControllerBehavior()
 {
     this._userSession = new SessionInfo();
     this._knownTypes = new List<EntityType>();
     this._serFormat = SerializationFormat.ODataAtom;
     this._scopeParameters = new Dictionary<string, string>();
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:7,代码来源:CacheControllerBehavior.cs

示例14: GenerateReader

		//*******************************************************
		// Reader generation
		//
		
		public void GenerateReader (string readerClassName, ArrayList maps)
		{
			if (_config == null || !_config.GenerateAsInternal)
				WriteLine ("public class " + readerClassName + " : XmlSerializationReader");
			else
				WriteLine ("internal class " + readerClassName + " : XmlSerializationReader");
			WriteLineInd ("{");
			// FromBinHexString() is not public, so use reflection here.
			WriteLine ("static readonly System.Reflection.MethodInfo fromBinHexStringMethod = typeof (XmlConvert).GetMethod (\"FromBinHexString\", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (string)}, null);");
			WriteLine ("static byte [] FromBinHexString (string input)");
			WriteLineInd ("{");
			WriteLine ("return input == null ? null : (byte []) fromBinHexStringMethod.Invoke (null, new object [] {input});");
			WriteLineUni ("}");

			_mapsToGenerate = new ArrayList ();
			_fixupCallbacks = new ArrayList ();
			InitHooks ();
			
			for (int n=0; n<maps.Count; n++)
			{
				GenerationResult res = (GenerationResult) maps [n];
				_typeMap = res.Mapping;
				_format = _typeMap.Format;
				_result = res;
				
				GenerateReadRoot ();
			}
			
			for (int n=0; n<_mapsToGenerate.Count; n++)
			{
				XmlTypeMapping map = _mapsToGenerate [n] as XmlTypeMapping;
				if (map == null) continue;
				
				GenerateReadObject (map);
				if (map.TypeData.SchemaType == SchemaTypes.Enum)
					GenerateGetEnumValueMethod (map);
			}
			
			GenerateReadInitCallbacks ();
			
			if (_format == SerializationFormat.Encoded)
			{
				GenerateFixupCallbacks ();
				GenerateFillerCallbacks ();
			}
			
			WriteLineUni ("}");
			UpdateGeneratedTypes (_mapsToGenerate);
		}
开发者ID:thenextman,项目名称:mono,代码行数:53,代码来源:SerializationCodeGenerator.cs

示例15: CacheRequestHandler

 protected CacheRequestHandler(Uri baseUri, SerializationFormat format, string scopeName)
 {
     this._baseUri = baseUri;
     this._serializationFormat = format;
     this._scopeName = scopeName;
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:6,代码来源:CacheRequestHandler.cs


注:本文中的SerializationFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。