Skip to content

Instantly share code, notes, and snippets.

@Qooh0
Last active September 18, 2023 19:06
Show Gist options
  • Save Qooh0/2215ba092b9ea31d0e8894030b1a9fee to your computer and use it in GitHub Desktop.
Save Qooh0/2215ba092b9ea31d0e8894030b1a9fee to your computer and use it in GitHub Desktop.
C-Sharp-Learning

Binary

Hex -> Char

byte data = 0x41;
System.Console.WriteLine((char)data);       // A

Hex array

byte[] data = new byte[2];
data[0] = 0x41;
data[1] = 0x42;
foreach (byte item in data)
{
    System.Console.WriteLine((char)item);   // A B                
}

Invoke

MS Document

Invoke

Static Functions

// public class SubCommands
Type subCommandClass = typeof(SubCommands);
MethodInfo? subCommand = subCommandClass.GetMethod(CapitalizeFirstLetter(firstArgument));
// namespace は省略可
Type subCommandClass = Type.GetType("<namespace>.SubCommands");
MethodInfo? subCommand = subCommandClass.GetMethod(CapitalizeFirstLetter(firstArgument));

Class Instance Functions

// public class SubCommands
SubCommands sc = new SubCommands();
Type subCommandClassInstance = sc.GetType();
MethodInfo? subCommand = subCommandClassInstance.GetMethod(CapitalizeFirstLetter(firstArgument));

not tested

引数を渡す

// Get the ItsMagic method and invoke with a parameter value of 100

MethodInfo magicMethod = magicType.GetMethod("ItsMagic");
object magicValue = magicMethod.Invoke(magicClassObject, new object[]{100});
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Microsoft RLC Report Designer について\n",
"\n",
"## インストール\n",
"\n",
"格闘機能として提供されているので、RDLC を検索して、拡張機能からダウンロード"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.8 ('base')",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.8.8"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "fc36fc9f8ee1a121e4202a259c0a0605dd93c4708658b4bb406dd11ab47a5df5"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

Stopwatch

var sw = new Stopwatch();
sw.Start();
for (int i = 0; i < 1000; i++)
{
    Thread.Sleep(1);
}
sw.Stop();

long milliSec = sw.ElapsedMilliseconds;
System.Console.WriteLine($"{milliSec} ms");     // 1163

long ticks = sw.ElapsedTicks;
System.Console.WriteLine($"{ticks} ticks");     // 11557911

他に、restart メソッドとか使いそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment