// RegisterSerializer(type)を対象になるクラスに走らせる
// (ListとDictは本体も生成したほうがいいので修正@21:14)
var alreadyGenerated = new HashSet<Type>();
var specializedSerializers = new HashSet<string>();
Action<Type> RegisterSerializer = null;
RegisterSerializer = type =>
{
if (type.IsArray) type = type.GetElementType();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 沢山の画像のURLリスト | |
var imageList = Enumerable.Range(1, 490).Select(x => x.ToString()); | |
imageList.ToObservable() | |
.Buffer(4) | |
.Select(xs => xs.Select(x => ObservableWWW.GetWWW(x)).WhenAll()) | |
.Concat() | |
.SelectMany(xs => xs, (_, www) => www.texture) | |
.Subscribe(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EventSourceConfiguratorExtensions | |
{ | |
public static void UseEventSource(this HostConfigurator configurator) | |
{ | |
HostLogger.UseLogger(new EventSourceHostLoggerConfigurator()); | |
} | |
} | |
[Serializable] | |
public class EventSourceHostLoggerConfigurator : HostLoggerConfigurator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IEnumerator ThreeSeconds() | |
{ | |
var sw = System.Diagnostics.Stopwatch.StartNew(); | |
yield return new WaitForSeconds(3); | |
Debug.Log(sw.Elapsed.TotalMilliseconds + "ms"); | |
} | |
// 3秒でかえってくる | |
Time.timeScale = 1.0f; | |
Observable.FromCoroutine(ThreeSeconds).Subscribe(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IL2CPP error for type 'Mono.Security.Protocol.Tls.Handshake.ClientCertificateType' in assembly '..\Temp\StagingArea\Data\Managed\Mono.Security.dll' | |
// Additional information: Build a development build for more information. Exception of type 'System.Exception' was thrown. | |
using System; | |
public interface IMyInterface<T> | |
{ | |
void OnNext(T value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() | |
{ | |
// GWRE2のモード対応表 | |
var Modes = | |
{ | |
"Deadline": "0", | |
"King": "5", | |
"Evolved": "1", | |
"Pacifism": "4", | |
"Wave": "3", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SerializationContext context = new SerializationContext() | |
{ | |
SerializationMethod = SerializationMethod.Array, | |
EnumSerializationMethod = EnumSerializationMethod.ByUnderlyingValue | |
}; | |
var intSerializer = context.GetSerializer<int>(); | |
var result = intSerializer.PackSingleObject(100); | |
var resultV = intSerializer.UnpackSingleObject(result); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.IO; | |
using System.Reflection; | |
using System.Text; | |
// serialize only:) | |
public static class TinyJsonSerializer | |
{ | |
static readonly Encoding bomlessUtf8 = new UTF8Encoding(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Text; | |
namespace CloudStructures | |
{ | |
public class JsonNetRedisValueConverter : ObjectRedisValueConverterBase | |
{ | |
protected override object DeserializeCore(Type type, byte[] value) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DictionaryDisposable<TKey, TValue> : IDisposable, IDictionary<TKey, TValue> | |
where TValue : IDisposable | |
{ | |
bool isDisposed = false; | |
readonly Dictionary<TKey, TValue> inner; | |
public DictionaryDisposable() | |
{ | |
inner = new Dictionary<TKey, TValue>(); | |
} |