質問するログイン新規登録

回答編集履歴

4

修正

2019/02/08 12:31

投稿

Zuishin
Zuishin

スコア28675

answer CHANGED
@@ -1,6 +1,7 @@
1
- [int] は RuntimeType 型です。これは型を表すクラスの型ですが、Public ではなくシステム内部で使われる型なので、外部で Type 型として扱ってください。
1
+ [int] は RuntimeType 型です。これは型を表すクラスの型ですが、Public ではなくシステム内部で Internal として宣言さている型なので、PowerShell など外部から使うことがきません。かわりにその基本型である Type 型を使ってください。
2
2
 
3
3
  参考 : [What's the difference between System.Type and System.RuntimeType in C#?](https://stackoverflow.com/questions/5737840/whats-the-difference-between-system-type-and-system-runtimetype-in-c)
4
+ ソース : [System.Runtime.Type](https://referencesource.microsoft.com/#mscorlib/system/rttype.cs,0d48ca51b2d2f8ed)
4
5
 
5
6
  ```
6
7
  [int]$i = 1

3

修正

2019/02/08 12:31

投稿

Zuishin
Zuishin

スコア28675

answer CHANGED
@@ -14,4 +14,5 @@
14
14
  class test {}
15
15
  [test]$test = [test]::new()
16
16
  [Type]$typeOfTest = [test]
17
+ [Type]$typeOfTest2 = $test.GetType()
17
18
  ```

2

修正

2019/02/08 12:17

投稿

Zuishin
Zuishin

スコア28675

answer CHANGED
@@ -8,7 +8,7 @@
8
8
  [Type]$t2 = $i.GetType()
9
9
  ```
10
10
 
11
- test クラスは test 型です。test 型の型は Type 型(RuntimeType 型)です。
11
+ test クラスのインスタンスは test 型です。test 型の型は Type 型(RuntimeType 型)です。
12
12
 
13
13
  ```
14
14
  class test {}

1

修正

2019/02/08 12:16

投稿

Zuishin
Zuishin

スコア28675

answer CHANGED
@@ -8,7 +8,7 @@
8
8
  [Type]$t2 = $i.GetType()
9
9
  ```
10
10
 
11
- test クラスは test 型です。の型は Type 型(RuntimeType 型)です。
11
+ test クラスは test 型です。test 型の型は Type 型(RuntimeType 型)です。
12
12
 
13
13
  ```
14
14
  class test {}