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
| var result = (ushort)((data[position + 1] << 8) | data[position]); |
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
| public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour | |
| { | |
| private static readonly Lazy<T> LazyInstance = new Lazy<T>(CreateSingleton); | |
| public static T Instance => LazyInstance.Value; | |
| private static T CreateSingleton() | |
| { | |
| var ownerObject = new GameObject($"{typeof(T).Name} (singleton)"); | |
| var instance = ownerObject.AddComponent<T>(); |
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
| var prime = new bool[1000]; | |
| for ( int i = 0; i < isPrime.Length; i++ ) | |
| { | |
| prime[i] = true; | |
| } |
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
| var prime = Enumerable.Repeat(true, 1000).ToArray(); |
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
| var data = new bool[1000]; | |
| Array.Fill(data, true); |
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
| public static void Fill<T>(T[] array, T value) | |
| { | |
| if (array == null) | |
| { | |
| ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); | |
| } | |
| for (int i = 0; i < array.Length; i++) | |
| { | |
| array[i] = value; |
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
| public static void Fill<T> (T[] array, T value, int startIndex, int count); |
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
| protected override void Up(MigrationBuilder migrationBuilder) | |
| { | |
| migrationBuilder.DropTable( | |
| name: "Cows"); | |
| migrationBuilder.DropPrimaryKey( | |
| name: "PK_Horses", | |
| table: "Horses"); | |
| migrationBuilder.DropColumn( |
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
| <TextBox BeforeTextChanging="TextBox_OnBeforeTextChanging" /> |
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
| private void TextBox_OnBeforeTextChanging(TextBox sender, | |
| TextBoxBeforeTextChangingEventArgs args) | |
| { | |
| args.Cancel = args.NewText.Any(c => !char.IsDigit(c)); | |
| } |