履歴: プログラミング/C#/型のプロパティ

各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 5 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます

日時タイトル文字数追加削除内容差分基準
2013/1/4 10:05:38プログラミング/C#/型のプロパティ 最新版3,532+1 -1表示差分—
2013/1/4 10:05:38プログラミング/C#/型のプロパティ 3,538+0 -9表示表示中選択
2013/1/3 17:01:42プログラミング/C#/型のプロパティ 3,680+9 -0表示差分選択
2009/8/30 11:02:41プログラミング/C#/型のプロパティ 3,538+97 -15表示差分選択
2009/8/30 10:17:45プログラミング/C#/型のプロパティ 888— —表示—基準

基準: プログラミング/C#/型のプロパティ (2009/8/30 10:17:45) → 比較: プログラミング/C#/型のプロパティ (2013/1/4 10:05:38)

@@ -1,23 +1,28 @@
[[公開メモ]]
-* かなりややこしい [#b2ac63c3]
+* typeof(XXX).Is???? の結果 [#b2ac63c3]
+|Array|Int32|IntPtr|Void*|Decimal|Test1|Enum|Test2|String|Array|Int32[]|Test3|
+|Abstract|×|×|×|×|×|○|×|×|○|×|×|
+|Array|×|×|×|×|×|×|×|×|×|○|×|
+|AutoLayout|×|×|○|×|×|○|○|○|○|○|○|
+|Class|×|×|BGCOLOR(Red):○|×|×|×|×|BGCOLOR(Red):○|BGCOLOR(Red):○|BGCOLOR(Red):○|○|
+|Enum|×|×|×|×|×|×|○|×|×|×|×|
+|LayoutSequential|○|○|×|○|○|×|×|×|×|×|×|
+|Nested|×|×|×|×|○|×|○|×|×|×|○|
+|NestedPublic|×|×|×|×|○|×|○|×|×|×|○|
+|NotPublic|×|×|○|×|×|×|×|×|×|×|×|
+|Pointer|×|BGCOLOR(Red):×|○|×|×|×|×|×|×|×|×|
+|Primitive|○|BGCOLOR(Red):○|×|×|×|×|×|×|×|×|×|
+|Public|○|○|BGCOLOR(Red):×|○|BGCOLOR(Red):×|○|BGCOLOR(Red):×|○|○|○|BGCOLOR(Red):×|
+|Sealed|○|○|BGCOLOR(Red):×|○|○|×|BGCOLOR(Red):○|○|×|○|×|
+|Serializable|○|BGCOLOR(Red):○|×|○|×|○|○|○|○|○|×|
+|ValueType|○|BGCOLOR(Red):○|×|○|○|BGCOLOR(Red):×|○|×|×|×|×|
+|SubclassOf(typeof(ValueType))|○|BGCOLOR(Red):○|×|○|○|○|○|×|×|×|×|
-||Abstract|Array|AutoLayout|Class|Enum|LayoutSequential|Nested|NestedPublic|NotPublic|Pointer|Primitive|Public|Sealed|Serializable|ValueType|SubclassOf(typeof(ValueType))|
-|Int32 |×|×|×|×|×|○|×|×|×|×|○|○|○|○|○|○|
-|IntPtr |×|×|×|×|×|○|×|×|×|×|○|○|○|○|○|○|
-|Void* |×|×|○|○|×|×|×|×|○|○|×|×|×|×|×|×|
-|Decimal |×|×|×|×|×|○|×|×|×|×|×|○|○|○|○|○|
-|Test1 |×|×|×|×|×|○|○|○|×|×|×|×|○|×|○|○|
-|Enum |○|×|○|×|×|×|×|×|×|×|×|○|×|○|×|○|
-|Test2 |×|×|○|×|○|×|○|○|×|×|×|×|○|○|○|○|
-|String |×|×|○|○|×|×|×|×|×|×|×|○|○|○|×|×|
-|Array |○|×|○|○|×|×|×|×|×|×|×|○|×|○|×|×|
-|Int32[] |×|○|○|○|×|×|×|×|×|×|×|○|○|○|×|×|
-|String[] |×|○|○|○|×|×|×|×|×|×|×|○|○|○|×|×|
-|Test3 |×|×|○|○|×|×|○|○|×|×|×|×|×|×|×|×|
+ちなみに、
- LANG: C#
+ LANGUAGE:C#
namespace TestNameSpace
{
class Test
@@ -27,3 +32,80 @@
public class Test3 { }
}
}
+
+とした。
+
+* 覚え書き [#d2b22d19]
+
+まず、
+
+bool~
+char~
+数値型(sbyte, byte, short, ushort, int, uint, long, ulong, float, double)~
+IntPtr
+
+は Primitive として、同じ扱いを受ける。
+
+IntPtr が Primitive, !IsPointer, ValueType, Serializable であるのは想像しづらい。
+
+void* は !Primitive, IsPointer, !ValueType, !Serializable である。
+
+さらに void* は IsClass なので、class のみを扱いたければ IsPointer を見て先に除かないといけない。
+
+string, int[] にも IsClass がついているので、これらも特別扱いが必要。
+
+IsPublic は普通に思い浮かべる public かどうかではない。
+
+* IsPublic などについて [#l4849f3d]
+
+| | |Nested |Nested Assembly |Nested FamANDAssem |Nested Family |Nested FamORAssem |Nested Private |Nested Public |NotPublic |Public|
+|Public | |× |× |× |× |× |× |× |× |○|
+|Public+Public_ | |○ |× |× |× |× |× |○ |× |×|
+|Public+Private | |○ |× |× |× |× |○ |× |× |×|
+|Public+Private+Public | |○ |× |× |× |× |× |○ |× |×|
+|Public+Protected | |○ |× |× |○ |× |× |× |× |×|
+|Public+Internal | |○ |○ |× |× |× |× |× |× |×|
+|Public+ProtectedInternal | |○ |× |× |× |○ |× |× |× |×|
+|Internal | |× |× |× |× |× |× |× |○ |×|
+|Internal+Public | |○ |× |× |× |× |× |○ |× |×|
+|Internal+Private | |○ |× |× |× |× |○ |× |× |×|
+|Internal+Private+Public | |○ |× |× |× |× |× |○ |× |×|
+|Internal+Protected | |○ |× |× |○ |× |× |× |× |×|
+|Internal+Internal_ | |○ |○ |× |× |× |× |× |× |×|
+|Internal+ProtectedInternal | |○ |× |× |× |○ |× |× |× |×|
+
+各クラスの定義は以下の通り。
+
+ LANGUAGE:C#
+ public class Public
+ {
+ public static Type GetPrivate() { return typeof(Private); }
+ public static Type GetPrivatePublic() { return typeof(Private.Public); }
+ public static Type GetProtected() { return typeof(Protected); }
+ public class Public_ { }
+ private class Private { public class Public { } }
+ protected class Protected { }
+ internal class Internal { }
+ protected internal class ProtectedInternal { }
+ }
+ internal class Internal
+ {
+ public static Type GetPrivate() { return typeof(Private); }
+ public static Type GetProtected() { return typeof(Protected); }
+ public static Type GetPrivatePublic() { return typeof(Private.Public); }
+ public class Public { }
+ private class Private { public class Public { } }
+ protected class Protected { }
+ internal class Internal_ { }
+ protected internal class ProtectedInternal { }
+ }
+
+IsNested なクラスについては、IsNestedXXX を見ることで、自身に付けられた修飾子を得ることができる。
+
+!IsNested なクラスについては、NotPublic か Public を見ることで、internal か public かが分かる。
+何も付けなければ internal になる。
+
+
+* コメント [#x238ba0e]
+
+#article_kcaptcha