This file contains hidden or 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.Runtime.CompilerServices; | |
| public static class Program { | |
| public unsafe static void Main() { | |
| var array=new int[1000]; | |
| var c=new C(); | |
| var header=Unsafe.Subtract(ref c.Field,2); | |
| var typeHandle=Unsafe.Subtract(ref c.Field,1); | |
| var data=new CData(){Header=header,Handle=typeHandle,Field=4ul}; | |
| var dataPtr=&data.Handle; |
This file contains hidden or 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.Runtime.CompilerServices; | |
| using System.Runtime.InteropServices; | |
| #if UNITY_EDITOR | |
| using Mono.Cecil; | |
| using Mono.Cecil.Cil; | |
| public static class ByRefGen { | |
| public static void RemoveByRefType(string src, string dst) { | |
| ModuleDefinition moduleDefinition = AssemblyDefinition.ReadAssembly(src).MainModule; |
This file contains hidden or 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
| #if UNITY_EDITOR | |
| #define EDITOR | |
| #endif | |
| using System; | |
| using System.Reflection; | |
| using System.Runtime.CompilerServices; | |
| namespace ReflectionUtils { | |
| public delegate void RefDelegate(ref byte t); | |
| public delegate void StructConstructorDelegate<T,in TArg0>(ref T t,TArg0 arg0); |
This file contains hidden or 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 SharpLab.Runtime; | |
| using System.Runtime.CompilerServices; | |
| object boxedManagedData=new ManagedData(""); | |
| object boxedUnManagedData=new UnManagedData(1); | |
| unsafe { | |
| Inspect.Heap(boxedManagedData); | |
| var p=Unsafe.AsPointer(ref ManagedData.StaticData); | |
| foreach(var b in BitConverter.GetBytes(((ulong*)p)[-1])){ |
This file contains hidden or 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.Collections.Generic; | |
| using System.Runtime.CompilerServices; | |
| PArray<int> pArray=[1,2,3,4]; | |
| pArray[1..3]=[0,0]; | |
This file contains hidden or 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
| /* | |
| SharpLab tools in Run mode: | |
| • value.Inspect() | |
| • Inspect.Heap(object) | |
| • Inspect.Stack(value) | |
| • Inspect.MemoryGraph(value1, value2, …) | |
| */ | |
| using System; | |
| using System.Collections; | |
| using System.Linq; |
This file contains hidden or 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
| namespace System.Runtime.CompilerServices | |
| { | |
| public ref partial struct DefaultInterpolatedStringHandler | |
| { | |
| public void AppendFormatted(float value)=> AppendFormatted(value, null); | |
| public void AppendFormatted(int value)=> AppendFormatted(value, null); | |
| public void AppendFormatted(double value)=> AppendFormatted(value, null); |
This file contains hidden or 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
| // Licensed to the .NET Foundation under one or more agreements. | |
| // The .NET Foundation licenses this file to you under the MIT license. | |
| #nullable enable | |
| using System.Buffers; | |
| using System.Diagnostics; | |
| using System.Globalization; | |
| using System.Runtime.InteropServices; | |
| namespace System.Runtime.CompilerServices |
This file contains hidden or 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
| //License | |
| //These codes are licensed under CC0. | |
| using System.IO; | |
| using System.Text; | |
| using UnityEngine; | |
| static class ConsoleRedirect | |
| { | |
| [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] | |
| static void ConsoleInit() |
This file contains hidden or 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
| //These codes are licensed under CC0. | |
| using System; | |
| using System.Collections.Generic; | |
| //using RomajiReader; | |
| // var reader = Reader.Default; | |
| // Console.WriteLine(reader.Convert("shinkyoku"));//しゅんきょく | |
| // Console.WriteLine(reader.Convert("kappa"));//かっぱ | |
| // Console.WriteLine(reader.Convert("cinkya"));//しんきゃ | |
| // Console.WriteLine(reader.Convert("rweqqap"));//rうぇっくぁp | |
| // Console.WriteLine(reader.Convert("RWEQQAP"));//RうぇっくぁP |
OlderNewer