C#教科書を身につける.ダイナミックタイプ
1558 ワード
https://www.youtube.com/watch?v=6sKaXWwfL38&list=PLO56HZSjrPTB4NxAsEP8HRk6YKBDLbp7m&index=73
動的キーワード の実行時にデータ型を決定するすべてのタイプを含むことができるタイプ. 文字列ss=「コンパイルポイント」 varvs=「コンパイルポイント」; 動的=ds=「運転時点」 C# dynamic == JS var, let
1.ダイナミックタイプ
2.プロジェクト
using System;
using static System.Console;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Reflection;
namespace testProject
{
class Program
{
static void Main(string[] args)
{
dynamic x;
x = 1_234;
WriteLine($"{x} - {x.GetType()}");
x = "Dynamic Type!";
WriteLine($"{x} - {x.GetType()}");
string ss = "Hello";
WriteLine(ss.Length);
var vs = "Hello";
WriteLine(vs.Length);
dynamic ds = "Hello";
WriteLine(ds.Length);
}
}
}




Reference
この問題について(C#教科書を身につける.ダイナミックタイプ), 我々は、より多くの情報をここで見つけました https://velog.io/@ansalstmd/C교과서-마스터하기-38.-동적-형식Dynamic-Typeテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol