NETLink Example 02: Net-Object-Reflection
- To: mathgroup at smc.vnet.net
- Subject: [mg47682] NETLink Example 02: Net-Object-Reflection
- From: "ToolmakerSteve" <ToolmakerSteve at shawstudio.com>
- Date: Wed, 21 Apr 2004 05:23:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Some experiments in looking at the properties and methods of .NET objects. Includes listing members of arrays and collections. For keyed collections, can either enumerate the members, or get a list of key-value pairs. First, some simple tests, using calls to Object.Type and (maybe) System.Reflection members. Then, builds up some useful functions. Sections: * Utilities * Fields [Not Yet Implemented -- Use "Properties" Instead ] * Methods * Properties * Both Properties & Methods * Examining Collections * * Values (Elements) of an Array * * Array or Collection, using IEnumerator * * Keys of a Collection * * Examining various collections * * Copying To an Array * Examples * * Examine objects in nb#01-NetLink+CodeDom-Tests Cut & Paste the following Notebook Expression into any open notebook. -- ToolmakerSteve - - - - - - - - - - Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox["(* nb#02-Net-Object-Reflection.", "Subtitle"], StyleBox["\nSome experiments in looking at the properties and \ methods of .NET objects.\nIncludes listing members of arrays and \ collections.\nFor keyed collections, can either enumerate the \ members, or get a list of key-value pairs.\nFirst, some simple tests, \ using calls to Object.Type and (maybe) System.Reflection members.\n\ Then, builds up some useful functions.\n *)", "Subsection"] }], "Subsubtitle"], Cell[BoxData[ \(\(\( (*\ \(--\(-\ Quiet\)\)\ spell\ warnings\ + \ limit\ output\ \(length\ --\) - \ *) \)\(\n\)\(Off[ General::spell]; \ \ \ Off[General::spell1];\n \($PrePrint = Short[#, 50] &;\)\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ \(Needs["\<NETLink`\>"]\), "\[IndentingNewLine]", \(InstallNET[]\)}], "Input"], Cell[BoxData[ TagBox[\(LinkObject[ "C:\\Program Files\\Wolfram \ Research\\Mathematica\\5.0\\AddOns\\NETLink\\InstallableNET.exe", 2, 2]\), (Short[ #, 50]&)]], "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["\n(* --------------- Simple Tests \ --------------- *)", "Subsection", FontSize->18]], "Subsubtitle"], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ The\)\ Type\ \("\<System.Object\>"\ --\)\ *) \)\(\ \[IndentingNewLine]\)\(object\[Bullet]Type = GetTypeObject[\ LoadNETType[\ "\<System.Object\>"\ ]\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.RuntimeType"] \[RightGuillemet]\), NETLink`Objects`NETObject$1897832902557697], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ Using\)\ System . Type\ features\ for\ examining\ a\ type . \ --\ *) \)\(\ \[IndentingNewLine]\)\(object\[Bullet]Type@ ToString[]\[IndentingNewLine] object\[Bullet]Type@FullName\[IndentingNewLine] (*\ CAUTION : \ "\<Object\>"\ is\ the\ one\ type\ that\ does\ NOT\ \ have\ a\ \(\(BaseType\)\(.\)\)\ *) \[IndentingNewLine] \((object\[Bullet]Type@BaseType)\) // FullForm\)\)\)], "Input"], Cell[BoxData[ TagBox["\<\"System.Object\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Object\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ StyleBox["Null", ShowSpecialCharacters->False, ShowStringCharacters->True, NumberMarks->True], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(object\[Bullet]Type@GetFields[]\), "\[IndentingNewLine]", \(object\[Bullet]Type@GetProperties[]\), "\[IndentingNewLine]", \(object\[Bullet]Type@GetMethods[]\), "\[IndentingNewLine]", \(Map[\ #@Name &, object\[Bullet]Type@GetMethods[]\ ]\)}], "Input"], Cell[BoxData[ TagBox[\({}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ RowBox[{"{", RowBox[{ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796093489905665], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796094160994305], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796094832082945], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796096845348865], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796097516437505], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796098187526145]}], "}"}], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"GetHashCode", "Equals", "ToString", "Equals", "ReferenceEquals", "GetType"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ An\)\ \("\<object\>"\ --\)\ \ *) \)\(\[IndentingNewLine]\)\(netOb1 = NETNew[\ "\<System.Object\>"\ ]\[IndentingNewLine] netOb1@ToString[]\[IndentingNewLine] \((netOb1@GetType[])\) === object\[Bullet]Type\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Object"] \[RightGuillemet]\), NETLink`Objects`NETObject$83886081], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Object\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["True", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ An\)\ "\<Int32\>"\ object . \ --\ \ *) \)\(\[IndentingNewLine]\)\(num = MakeNETObject[\ 11\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32"] \[RightGuillemet]\), NETLink`Objects`NETObject$184549377], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ An\)\ "\<Array\>"\ object . \ --\ \ *) \)\(\[IndentingNewLine]\)\(nums = MakeNETObject[\ {11, 22, 33}\ ]\[IndentingNewLine] nums@GetValue[\ 0\ ]\[IndentingNewLine] nums@Length\[IndentingNewLine] NETObjectToExpression[\ nums\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$100663297], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["11", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["3", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ An\)\ "\<Array\>"\ of\ a\ specified\ type . \ --\ *) \)\(\ \[IndentingNewLine]\)\(bytes = MakeNETObject[\ {0, 128, 255}, "\<System.Byte[]\>"\ ]\[IndentingNewLine] NETObjectToExpression[\ bytes\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Byte[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$117440513], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({0, 128, 255}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ A\)\ method . \ --\ \ *) \)\(\[IndentingNewLine]\)\(netObMethod1 = \((object\[Bullet]Type@ GetMethods[])\)\[LeftDoubleBracket]\ 1\ \[RightDoubleBracket]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796093489905665], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ Examining\)\ details\ of\ a\ method . \ --\ *) \)\(\ \[IndentingNewLine]\)\(netObMethod1@ToString[]\[IndentingNewLine] netObMethod1@\(ReturnType@ToString[]\)\[IndentingNewLine] netObMethod1@Name\[IndentingNewLine] netObMethod1@GetParameters[]\[IndentingNewLine] \(\((\((#@\(ReturnType@ToString[]\))\) <> "\< \>" <> \((#@ Name)\) <> ToString[\ #@GetParameters[]\ ])\) &\)[\ netObMethod1\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox["\<\"Int32 GetHashCode()\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Int32\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"GetHashCode\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Int32 GetHashCode{}\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ A\)\ more\ interesting\ method . \ --\ *) \)\(\ \[IndentingNewLine]\)\(netObMethod2 = \((object\[Bullet]Type@ GetMethods[])\)\[LeftDoubleBracket]\ 4\ \[RightDoubleBracket]\[IndentingNewLine] netObMethod2@ToString[]\[IndentingNewLine] \(\((\((#@\(ReturnType@ToString[]\))\) <> "\< \>" <> \((#@ Name)\) <> ToString[\ #@GetParameters[]\ ])\) &\)[\ netObMethod2\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimeMethodInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3796096845348865], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"Boolean Equals(System.Object, System.Object)\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Boolean \ Equals{<<NETObject[System.Reflection.ParameterInfo]>>, \ <<NETObject[System.Reflection.ParameterInfo]>>}\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ Details\)\ of\ a\ parameter\ to\ a\ method . \ --\ *) \)\(\ \[IndentingNewLine]\)\(\(\((\((#@\(ParameterType@ FullName\))\) <> "\< \>" <> \ \((#@ Name)\))\) &\)[\[IndentingNewLine]\((netObMethod2@ GetParameters[])\)\[LeftDoubleBracket]\ 1\ \[RightDoubleBracket]\[IndentingNewLine]]\)\)\)], \ "Input"], Cell[BoxData[ TagBox["\<\"System.Object objA\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["(* ", "Subsection"], StyleBox["========== FUNCTION DEFINITIONS ==========", "Subsection", FontSize->18], StyleBox["\nBuild up some functions to display object and type \ details.\n*)", "Subsection"] }], "Title"], Cell[BoxData[ \( (*\ HACK : \ Dummy\ code\ cell, \ so\ can\ "\<collapse\>"\ the\ following\ \(\(section\)\(.\)\)\ *) \ \)], "Input"], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* --------------- Utilities --------------- \ *)", "Title", FontSize->18, FontWeight->"Bold"]], "Subtitle"], Cell[BoxData[ \(\(\( (*\ \(\(\(--\(--\(-\ \(ListWhile\ --\)\)\)\)--\)\(-\)\); \ \[IndentingNewLine]Like\ "\<Map\>", \ but\ for\ \(\(enumerators\)\(.\)\)\[IndentingNewLine]*) \)\(\ \[IndentingNewLine]\)\(ListWhile[\ it_, testExpr_, valueExpr_\ ] := \[IndentingNewLine]Module[\ {answers}, \ \[IndentingNewLine]answers = {}; \[IndentingNewLine]While[\ testExpr[\ it\ ], \[IndentingNewLine]\(AppendTo[\ answers, valueExpr[\ it\ ]\ ];\)\[IndentingNewLine]]; \ \[IndentingNewLine]answers\[IndentingNewLine]];\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Utilities\)\)\)\ to\ format\ a\ dump\ of\ parts\ of\ a\ \ list . \ \(--\(---\)\)\ *) \)\(\[IndentingNewLine]\)\(\ \[IndentingNewLine]\)\(\(PrintPrefixed[\ any_, prefix_\ ] := Print[\ prefix <> ToString[\ any\ ]\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(PrintParts[\ list_\ ] := Map[\ Print, list\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(PrintParts[\ list_, message_, prefix_\ ] \ := \[IndentingNewLine]\((\[IndentingNewLine]Print[\ message\ ]; \[IndentingNewLine]Map[\ PrintPrefixed[\ #, prefix\ ] &, list\ ];\[IndentingNewLine])\);\)\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ If\)\)\)\ "\<value\>"\ is\ "\<Null\>", \ replace\ with\ "\<default\>" . \ \(--\(---\)\)\ *) \)\(\ \[IndentingNewLine]\)\(NullToDefault[\ value_, default_\ ] := \[IndentingNewLine]If[\ value === Null, default, value\ ];\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ For\)\)\)\ Zero - Indexed\ Net\ Functions . \ \(--\(---\)\)\ *) \)\(\ \[IndentingNewLine]\)\(TableZI[\ func_, cnt_\ ] := \[IndentingNewLine]Table[\ func[\ i - 1\ ], {i, cnt}\ ];\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(\(\(\(--\(--\(-\ NetType\)\)\)\ &\)\ \(\(Name\ --\)--\)\)\(-\)\); \ \[IndentingNewLine]E . g . \ "\<System.CodeDom.CodeTypeDeclaration \ HelloWorldMsgApp\>"\ *) \)\(\[IndentingNewLine]\)\(TypeAndName[\ netOb_, name_\ ] := \[IndentingNewLine]\((\ \((netOb@\(GetType[]@ FullName\))\) <> "\< \>" <> name)\);\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(\(\(\(--\(--\(-\ CodeDomType\)\)\)\ &\)\ \(\(Name\ \ --\)--\)\)\(-\)\); \[IndentingNewLine]E . g . \ "\<System.CodeDom.CodeTypeDeclaration \ HelloWorldMsgApp\>"\ *) \)\(\[IndentingNewLine]\)\(CodeDomType\ \[Bullet]TypeAndName\[Bullet]String[\ codeType_\ ] := \[IndentingNewLine]\((\ \ \((codeType@\(GetType[]@FullName\))\) <> "\< \>" <> \((codeType@ Name)\))\);\)\)\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["\n(* --------------- Fields ---------------\n", "Subsubtitle", FontSize->18, FontWeight->"Bold"], StyleBox["TBD. For now, see \"Properties\", which includes \ \"Fields\".\nHere belongs similar work using \"@GetFields[]\".\n", "Subsubtitle", FontSize->14, FontWeight->"Bold"], StyleBox["*)", "Subsubtitle", FontSize->18, FontWeight->"Bold"] }], "Subtitle"], Cell[BoxData[ \( (*\ TBD\ *) \)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["\n(* --------------- Method Descriptors \ --------------- *)", "Title", FontSize->18, FontWeight->"Bold"]], "Subtitle"], Cell[BoxData[ \(\(\( (*\ \(\(--\(--\(-\ \(\(ParamInfo\[Bullet]TypeAndName\ \[Bullet]String\ --\)--\)\)\)\)\(-\)\); \[IndentingNewLine]CAUTION : \ \ Some\ parameters\ are\ \(unnamed : \ "\<paramInfo@Name\>" === \ \(\(Null\)\(.\)\)\)\ \ *) \)\(\[IndentingNewLine]\)\(ParamInfo\[Bullet]TypeAndName\[Bullet]\ String[\ paramInfo_\ ] := \[IndentingNewLine]\((\ \ \((paramInfo@\(ParameterType@FullName\))\) <> "\< \>" <> NullToDefault[\ paramInfo@Name, "\<UNNAMED\>"\ ])\);\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ \(ParamInfo\[Bullet]TypeAndName\[Bullet]String[\ \((netObMethod2@ GetParameters[])\)\[LeftDoubleBracket]\ 1\ \[RightDoubleBracket]\ ]\), "\[IndentingNewLine]", \(Map[\ ParamInfo\[Bullet]TypeAndName\[Bullet]String, netObMethod2@GetParameters[]\ ]\)}], "Input"], Cell[BoxData[ TagBox["\<\"System.Object objA\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"System.Object objA", "System.Object objB"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(MethInfo\[Bullet]Params[\ methodInfo_\ ] := \[IndentingNewLine]Map[\ ParamInfo\[Bullet]TypeAndName\[Bullet]String, methodInfo@GetParameters[]\ ];\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ \(netObMethod2@ToString[]\), "\[IndentingNewLine]", \(\(\((\((#@\(ReturnType@ToString[]\))\) <> "\< \>" <> \((#@ Name)\) <> ToString[\ MethInfo\[Bullet]Params[\ #\ ]\ ])\) &\)[\ netObMethod2\ ]\)}], "Input"], Cell[BoxData[ TagBox["\<\"Boolean Equals(System.Object, System.Object)\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Boolean Equals{System.Object objA, \ System.Object objB}\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(\( (*\ \(--\ Descriptor\)\ of\ a\ \(method\ --\); \[IndentingNewLine]Put\ \ method\ name\ FIRST, \ so\ can\ SORT\ by\ \(\(name\)\(.\)\)\ \ *) \)\(\[IndentingNewLine]\)\(MethInfo\[Bullet]String[\ methodInfo_\ ] := \[IndentingNewLine]\((methodInfo@Name)\) <> ToString[\ MethInfo\[Bullet]Params[\ methodInfo\ ]\ ] <> "\<=> \>" <> \ \((methodInfo@\(ReturnType@ToString[]\))\);\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\ Descriptors\)\ of\ all\ methods\ of\ "\<System.Object\>" . \ \ --\ *) \)\(\[IndentingNewLine]\)\(Map[\ Print[\ MethInfo\[Bullet]String[\ #\ ]\ ] &, object\[Bullet]Type@GetMethods[]\ ];\)\)\)], "Input"], Cell[BoxData[ \("GetHashCode{}=> System.Int32"\)], "Print"], Cell[BoxData[ \("Equals{System.Object obj}=> System.Boolean"\)], "Print"], Cell[BoxData[ \("ToString{}=> System.String"\)], "Print"], Cell[BoxData[ \("Equals{System.Object objA, System.Object objB}=> \ System.Boolean"\)], "Print"], Cell[BoxData[ \("ReferenceEquals{System.Object objA, System.Object objB}=> \ System.Boolean"\)], "Print"], Cell[BoxData[ \("GetType{}=> System.Type"\)], "Print"] }, Open ]], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Optionally\)\)\)\ suppress\ method - \(\(descriptors\ \ --\)--\) - ; \[IndentingNewLine]that\ we\ usually\ don' t\ care\ \(\(about\)\(.\)\)\ \ *) \)\(\[IndentingNewLine]\)\(\(commonObscureMethods = \ {"\<GetHashCode\>"};\)\[IndentingNewLine] \(commonVerboseMethods = Union[\ {"\<Equals\>", "\<GetType\>", "\<ToString\>"}, commonObscureMethods\ ];\)\[IndentingNewLine]\ \[IndentingNewLine]\[IndentingNewLine] (*\ \(--\(--\(-\ Add\)\)\)\ own\ names\ to\ common\ property\ lists . \ \ \(--\(---\)\)\ *) \[IndentingNewLine] \(CustomObscureMethods[\ customNames_\ ] := Union[\ customNames, commonObscureMethods\ ];\)\[IndentingNewLine] \(CustomVerboseMethods[\ customNames_\ ] := Union[\ customNames, commonVerboseMethods\ ];\)\[IndentingNewLine]\ \[IndentingNewLine] \(RemoveFromList[\ list_, values_\ ] := \[IndentingNewLine]Complement[\ list, values\ ];\)\[IndentingNewLine]\[IndentingNewLine] (*\ \(\(\ --\(--\(-\ Add\)\)\)\ &\)\ remove\ own\ names\ to\ common\ \ property\ lists . \ \(--\(---\)\)\ *) \[IndentingNewLine] \(CustomObscureMethods[\ addNames_, removeNames_\ ] := \[IndentingNewLine]RemoveFromList[\ CustomObscureMethods[\ addNames\ ], removeNames\ ];\)\[IndentingNewLine] \(CustomVerboseMethods[\ addNames_, removeNames_\ ] := RemoveFromList[\ CustomVerboseMethods[\ addNames\ ], removeNames\ ];\)\[IndentingNewLine]\[IndentingNewLine]\ \[IndentingNewLine] \(arrayObscureMethods = CustomObscureMethods[\ {"\<get_IsFixedSize\>", \ "\<get_IsReadOnly\>", "\<get_IsSynchronized\>", "\<get_Length\>", \ "\<GetLongLength\>", "\<get_LongLength\>", "\<get_Rank\>", \ "\<get_SyncRoot\>"}\ ];\)\[IndentingNewLine] \(arrayVerboseMethods = Union[\ arrayObscureMethods, commonVerboseMethods\ ];\)\)\)\)], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ StyleBox[\(\(--\(--\(-\ \(\(SuppressMethods\ --\)--\)\)\)\)\ \(-\)\), FontFamily->"Arial", FontSize->16], ";", "\[IndentingNewLine]", \(Suppress\ common\ methods\ that\ \ are\ rarely\ \(\(interesting\)\(.\)\)\)}], " ", "*)"}], "\[IndentingNewLine]", \(SuppressMethods[\ methodInfos_, suppressMethods_\ ] := \[IndentingNewLine]Select[\ methodInfos, \(! MemberQ[\ suppressMethods, #@Name\ ]\) &\ ];\)}]], "Input"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Method\)\)\)\ \(Descriptors\ --\) \(---\); \ \[IndentingNewLine]Two\ \(cases : \ One\ where\ given\ a\ . NET\ Type\), \[IndentingNewLine]the\ other\ where\ \ given\ a\ CodeDom\ Type - \(\(Descriptor\)\(.\)\)\[IndentingNewLine]\ *) \)\(\[IndentingNewLine]\)\(\(NetType\[Bullet]MethInfo\[Bullet]\ Strings[\ netType_, suppressMethods_\ ] := \[IndentingNewLine]Map[\ MethInfo\[Bullet]String, \ \[IndentingNewLine]SuppressMethods[\ netType@GetMethods[], suppressMethods\ ]\ ];\)\[IndentingNewLine]\ \[IndentingNewLine] \(NetType\[Bullet]MethInfo\[Bullet]Strings[\ netType_\ ] := NetType\[Bullet]MethInfo\[Bullet]Strings[\ netType, {}\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ codeDomType_, suppressMethods_\ ] \ := \[IndentingNewLine]NetType\[Bullet]MethInfo\[Bullet]Strings[\ codeDomType@GetType[], suppressMethods\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ codeDomType_\ ] := CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ codeDomType, {}\ ];\)\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{\( (*\ \(--\(--\(-\ Print\)\)\)\ Method - \(Descriptors\ --\) \(---\); internal\ - \ used\ by\ both\ NetType\ and\ CodeDomType\ \ \(\(functions\)\(.\)\)\ *) \), "\[IndentingNewLine]", RowBox[{\(PrintMethods0[\ typeAndName_, methInfoStrings_, suppressMethods_\ ] := \[IndentingNewLine]PrintParts[\ \[IndentingNewLine]Sort[\ methInfoStrings\ ], \[IndentingNewLine]typeAndName <> \ "\<: Methods:\>", "\<. \>"\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(\(--\(--\(-\ Print\)\)\)\ Method - \(\(Descriptors\ --\)--\) \ - \), FontFamily->"Arial", FontSize->16], " ", "*)"}], "\[IndentingNewLine]", \(NetType\[Bullet]PrintMethods[\ netType_, name_, suppressMethods_\ ] \ := \[IndentingNewLine]PrintMethods0[\ name, NetType\[Bullet]MethInfo\[Bullet]Strings[\ netType, suppressMethods\ ], suppressMethods\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \(NetType\[Bullet]PrintMethods[\ netType_, suppressMethods_\ ] := \[IndentingNewLine]NetType\ \[Bullet]PrintMethods[\ netType, "\<type \>" <> netType@FullName, suppressMethods\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \(CodeDomType\[Bullet]PrintMethods[\ codeDomType_, suppressMethods_\ ] \ := \[IndentingNewLine]PrintMethods0[\ CodeDomType\[Bullet]TypeAndName\[Bullet]String[\ codeDomType\ ], CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ codeDomType, suppressMethods\ ], suppressMethods\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ Given\ an\ object, \ print\ methods\ of\ its\ \(\(type\)\(.\)\)\ *) \), "\[IndentingNewLine]", \(NetPrintMethods[\ netOb_, name_, suppressMethods_\ ] := \[IndentingNewLine]NetType\ \[Bullet]PrintMethods[\ netOb@GetType[], \ \[IndentingNewLine]\((netOb@\(GetType[]@FullName\))\) <> "\< \>" <> name, suppressMethods\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \(NetPrintMethods[\ netOb_, name_\ ] := \[IndentingNewLine]NetPrintMethods[\ netOb, name, {}\ ];\)}]}]], "Input"], Cell[BoxData[ TagBox[\(Null\^6\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(NetType\[Bullet]PrintMethods[\ object\[Bullet]Type\ ]\)], "Input"], Cell[BoxData[ TagBox[ RowBox[{"NetType\[Bullet]PrintMethods", "[", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.RuntimeType"] \[RightGuillemet]\), NETLink`Objects`NETObject$1897832902557697], "]"}], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(NetType\[Bullet]PrintMethods[\ object\[Bullet]Type, commonVerboseMethods\ ]\)], "Input"], Cell[BoxData[ \("type System.Object: Methods:"\)], "Print"], Cell[BoxData[ \(". ReferenceEquals{System.Object objA, System.Object objB}=> \ System.Boolean"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(NetPrintMethods[\ num, "\<num\>", commonVerboseMethods\ ]\)], "Input"], Cell[BoxData[ \("System.Int32 num: Methods:"\)], "Print"], Cell[BoxData[ \(". CompareTo{System.Object value}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". GetTypeCode{}=> System.TypeCode"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.Globalization.NumberStyles \ style, System.IFormatProvider provider}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.Globalization.NumberStyles \ style}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.IFormatProvider provider}=> \ System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s}=> System.Int32"\)], "Print"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["\n(* --------------- Properties ---------------\n", "Subsubtitle", FontSize->18, FontWeight->"Bold"], StyleBox["Examining a property takes a bit more work then examining \ a method.\nNeed to get the corresponding \"PropertyInfo\" from the \ object's type, then invoke \"GetV", "Subsubtitle", FontSize->14, FontWeight->"Bold"], StyleBox["alue\" on the object.", "Subsubtitle", FontSize->14, FontWeight->"Bold"], StyleBox["\n*)", "Subsubtitle", FontSize->18, FontWeight->"Bold"] }], "Subtitle"], Cell[CellGroupData[{ Cell[BoxData[{ \(nums\), "\[IndentingNewLine]", \(NETObjectToExpression[\ nums\ ]\), "\[IndentingNewLine]", \(\(type1 = nums@GetType[];\)\), "\[IndentingNewLine]", \(type1@FullName\), "\[IndentingNewLine]", \(type1@GetFields[]\), "\[IndentingNewLine]", \(props1 = type1@GetProperties[]\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$100663297], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Int32[]\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ RowBox[{"{", RowBox[{ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893381075828737], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893381814026241], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893382552223745], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893383290421249], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893384028618753], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893384766816257], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893385505013761]}], "}"}], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(strings = MakeNETObject[\ {"\<aardvark\>", "\<to\>", "\<zoology\>"}\ ]\), \ "\[IndentingNewLine]", \(NETObjectToExpression[\ strings\ ]\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.String[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$369098753], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"aardvark", "to", "zoology"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ A\ property\ of\ System . Int32[] . \ *) \)\(\[IndentingNewLine]\)\(prop1 = props1\[LeftDoubleBracket]\ 1\ \[RightDoubleBracket]\[IndentingNewLine] {prop1@Name, prop1@\(PropertyType@FullName\), prop1@GetValue[\ nums, {}]}\[IndentingNewLine] \(\((\((#@\(PropertyType@FullName\))\) <> "\< \>" <> \((#@ Name)\) <> "\<: \>" <> ToString[\ #@GetValue[\ nums, {}]\ ])\) &\)[\ prop1\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3893381075828737], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"Length", "System.Int32", 3}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.Int32 Length: 3\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ Most\ properties\ don' t\ need\ any\ parameters\ other\ than\ the\ object\ \ \(\(itself\)\(.\)\)\ *) \)\(\[IndentingNewLine]\)\(prop1@ GetIndexParameters[]\)\)\)], "Input"], Cell[BoxData[ TagBox[\({}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(\( (*\ Get\ the\ value\ of\ a\ property\ of\ an\ object; \ \[IndentingNewLine]Can' t\ evaluate\ a\ property\ that\ requires\ some\ \((unknown)\ \)\ parameter\ - \[IndentingNewLine]decided\ to\ return\ a\ string\ \ describing\ that\ \(\(fact\)\(.\)\)\ \ *) \)\(\[IndentingNewLine]\)\(\(GetPropValue\[Bullet]NullIfCant[\ netOb_, propInfo_\ ] := \[IndentingNewLine]If[\ Length[\ propInfo@GetIndexParameters[]\ ] \[Equal] 0, \[IndentingNewLine]propInfo@ GetValue[\ netOb, {}\ ], \[IndentingNewLine]Null\ ];\)\ \[IndentingNewLine]\[IndentingNewLine] \(GetPropValue\[Bullet]WarnIfCant[\ netOb_, propInfo_\ ] := \[IndentingNewLine]NullToDefault[\ GetPropValue\[Bullet]NullIfCant[\ netOb, propInfo\ ], "\<***needs param(s)***\>"\ ];\)\ \[IndentingNewLine]\[IndentingNewLine] \(PropValue\[Bullet]ToString[\ netOb_, propInfo_\ ] := \[IndentingNewLine]\((propInfo@ Name)\) <> "\< <\>" <> \((propInfo@\(PropertyType@ FullName\))\) <> "\<>: \>" <> ToString[\ GetPropValue\[Bullet]WarnIfCant[\ netOb, propInfo\ ]\ ];\)\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(PropValue\[Bullet]ToString[\ nums, prop1\ ]\)], "Input"], Cell[BoxData[ TagBox["\<\"Length <System.Int32>: 3\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[{ \(\(EnumProperties[\ netOb_\ ] := \[IndentingNewLine]netOb@\(GetType[]@ GetProperties[]\);\)\[IndentingNewLine]\[IndentingNewLine]\ (*\ Suppress\ common\ properties\ that\ are\ rarely\ \(\(interesting\ \)\(.\)\)\ *) \), "\[IndentingNewLine]", \(\(EnumProperties[\ netOb_, suppressProps_\ ] := \[IndentingNewLine]Module[\ \ {allProps}, \[IndentingNewLine]allProps = EnumProperties[\ netOb\ ]; \[IndentingNewLine]Select[\ allProps, \(! MemberQ[\ suppressProps, #@ Name\ ]\) &\ ]\[IndentingNewLine]];\)\)}], \ "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(Map[\ PropValue\[Bullet]ToString[\ nums, #\ ] &, EnumProperties[\ nums\ ]\ ]\)], "Input"], Cell[BoxData[ TagBox[\({"Length <System.Int32>: 3", "LongLength <System.Int64>: 3", "Rank <System.Int32>: 1", "SyncRoot <System.Object>: {11, 22, 33}", "IsReadOnly <System.Boolean>: False", "IsFixedSize <System.Boolean>: True", "IsSynchronized <System.Boolean>: False"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{\( (*\ Optionally\ suppress\ object\ properties\ that\ we\ usually\ \ don' t\ care\ \(\(about\)\(.\)\)\ *) \), "\[IndentingNewLine]", RowBox[{\(commonObscureProperties = {"\<IsSynchronized\>", \ "\<LongLength\>", "\<Rank\>", "\<SyncRoot\>"};\), "\[IndentingNewLine]", \(commonVerboseProperties = Union[\ {"\<IsFixedSize\>", "\<IsReadOnly\>"}, commonObscureProperties\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ \(--\(--\(-\ Add\)\)\)\ own\ names\ to\ common\ property\ lists \ . \ \(--\(---\)\)\ *) \), "\[IndentingNewLine]", \(CustomObscureProps[\ customNames_\ ] := Union[\ customNames, commonObscureProperties\ ];\), "\[IndentingNewLine]", \(CustomVerboseProps[\ customNames_\ ] := Union[\ customNames, commonVerboseProperties\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \(RemoveFromList[\ list_, values_\ ] := \[IndentingNewLine]Complement[\ list, values\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ \(\(--\(--\(-\ Add\)\)\)\ &\)\ remove\ own\ names\ to\ common\ \ property\ lists . \ \(--\(---\)\)\ *) \), "\[IndentingNewLine]", \(CustomObscureProps[\ addNames_, removeNames_\ ] := \[IndentingNewLine]RemoveFromList[\ CustomObscureProps[\ addNames\ ], removeNames\ ];\), "\[IndentingNewLine]", \(CustomVerboseProps[\ addNames_, removeNames_\ ] := RemoveFromList[\ CustomVerboseProps[\ addNames\ ], removeNames\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(\(--\(--\(-\ Print\[Bullet]PropValues\)\)\), \ \(\(with\ \ \(\(suppressProps\ --\)--\)\)\(-\)\)\), FontFamily->"Arial", FontSize->16], " ", "*)"}], \(Print\[Bullet]PropValues[\ netOb_, name_, suppressProps_\ ] := \[IndentingNewLine]PrintParts[\ \[IndentingNewLine]Sort[\ Map[\ PropValue\[Bullet]ToString[\ netOb, #\ ] &, EnumProperties[\ netOb, suppressProps\ ]\ ]\ ], \ \[IndentingNewLine]TypeAndName[\ netOb, name\ ] <> "\<: \>" <> "\<Selected Property Values:\ \>", "\<. \>"\ ];\), "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", StyleBox[\(\(--\(--\(-\ Print\[Bullet]PropValues\)\)\), \ \(\(even\ obscure\ \ \(\(ones\ --\)--\)\)\(-\)\)\), FontFamily->"Arial", FontSize->16], " ", "*)"}], "\[IndentingNewLine]", \(Print\[Bullet]PropValues[\ netOb_, name_\ ] \ := \[IndentingNewLine]Print\[Bullet]PropValues[\ netOb, name, {}\ ];\)}]}]], "Input"], Cell[BoxData[ TagBox[\(Null\^9\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(\(\(allowReadOnlyAndRank\[Bullet]VerboseProps = CustomVerboseProps[\ {}, {"\<IsReadOnly\>", "\<Rank\>"}\ ]\)\(\ \[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(allowFixedSize\[Bullet]VerboseProps = \ \[IndentingNewLine]CustomVerboseProps[\ {}, {"\<IsFixedSize\>"}\ \ ]\)}], "Input"], Cell[BoxData[ TagBox[\({"IsFixedSize", "IsSynchronized", "LongLength", "SyncRoot"}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"IsReadOnly", "IsSynchronized", "LongLength", "Rank", "SyncRoot"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ nums, "\<nums\>"\ ]\)], "Input"], Cell[BoxData[ \("System.Int32[] nums: Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". IsFixedSize <System.Boolean>: True"\)], "Print"], Cell[BoxData[ \(". IsReadOnly <System.Boolean>: False"\)], "Print"], Cell[BoxData[ \(". IsSynchronized <System.Boolean>: False"\)], "Print"], Cell[BoxData[ \(". Length <System.Int32>: 3"\)], "Print"], Cell[BoxData[ \(". LongLength <System.Int64>: 3"\)], "Print"], Cell[BoxData[ \(". Rank <System.Int32>: 1"\)], "Print"], Cell[BoxData[ \(". SyncRoot <System.Object>: {11, 22, 33}"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ nums, "\<nums\>", allowFixedSize\[Bullet]VerboseProps\ ]\)], "Input"], Cell[BoxData[ \("System.Int32[] nums: Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". IsFixedSize <System.Boolean>: True"\)], "Print"], Cell[BoxData[ \(". Length <System.Int32>: 3"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ strings, "\<strings\>", commonVerboseProperties\ ]\)], "Input"], Cell[BoxData[ \("System.String[] strings: Selected Property Values:"\)], \ "Print"], Cell[BoxData[ \(". Length <System.Int32>: 3"\)], "Print"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["\n(* --------------- Both Properties & \ Methods --------------- *)", "Title", FontSize->18, FontWeight->"Bold"]], "Subtitle"], Cell[BoxData[{ \(\(Print\[Bullet]PropValuesAndMethods[\ netOb_, name_, suppressProps_, suppressMethods_\ ] := \[IndentingNewLine]\((name <> "\<: \ \>" <> netOb@ToString[] // Print; \[IndentingNewLine]Print\[Bullet]PropValues[\ netOb, name, suppressProps\ ]; \[IndentingNewLine]NetPrintMethods[\ netOb, name, suppressMethods\ ];\[IndentingNewLine])\);\)\ \[IndentingNewLine]\[IndentingNewLine] (*\ By\ default, \ \(omit\ commonVerboseProperties\ &\)\ methods\ *) \ \), "\[IndentingNewLine]", \(\(Print\[Bullet]PropValuesAndMethods[\ netOb_, name_\ ] \ := \[IndentingNewLine]Print\[Bullet]PropValuesAndMethods[\ \[IndentingNewLine]netOb, name, commonVerboseProperties, commonVerboseMethods\ ];\)\)}], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValuesAndMethods[\ num, "\<num\>"\ ]\)], "Input"], Cell[BoxData[ \("num: 11"\)], "Print"], Cell[BoxData[ \("System.Int32 num: Selected Property Values:"\)], "Print"], Cell[BoxData[ \("System.Int32 num: Methods:"\)], "Print"], Cell[BoxData[ \(". CompareTo{System.Object value}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". GetTypeCode{}=> System.TypeCode"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.Globalization.NumberStyles \ style, System.IFormatProvider provider}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.Globalization.NumberStyles \ style}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s, System.IFormatProvider provider}=> \ System.Int32"\)], "Print"], Cell[BoxData[ \(". Parse{System.String s}=> System.Int32"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ For\ an\ array, \ we\ get\ lots\ of\ \(info\ --\)\ but\ not\ the\ CONTENTS\ of\ \ the\ array; \[IndentingNewLine]This\ is\ also\ true\ for\ COLLECTIONS \ . \[IndentingNewLine]To\ fix\ this, \ See\ Section\ \(\("\<Examining Collections\>"\)\(.\)\)\ \[IndentingNewLine]*) \)\(\[IndentingNewLine]\)\(Print\[Bullet]\ PropValuesAndMethods[\ nums, "\<nums\>", commonVerboseProperties, arrayVerboseMethods\ ]\)\)\)], "Input"], Cell[BoxData[ \("nums: System.Int32[]"\)], "Print"], Cell[BoxData[ \("System.Int32[] nums: Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". Length <System.Int32>: 3"\)], "Print"], Cell[BoxData[ \("System.Int32[] nums: Methods:"\)], "Print"], Cell[BoxData[ \(". AddressAt{System.Int32 UNNAMED}=> System.Int32&"\)], \ "Print"], Cell[BoxData[ \(". Address{System.Int32 UNNAMED}=> System.Int32&"\)], "Print"], Cell[BoxData[ \(". Clone{}=> System.Object"\)], "Print"], Cell[BoxData[ \(". CopyTo{System.Array array, System.Int32 index}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". CopyTo{System.Array array, System.Int64 index}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". GetAt{System.Int32 UNNAMED}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". GetEnumerator{}=> System.Collections.IEnumerator"\)], \ "Print"], Cell[BoxData[ \(". GetLength{System.Int32 dimension}=> System.Int32"\)], \ "Print"], Cell[BoxData[ \(". GetLowerBound{System.Int32 dimension}=> System.Int32"\)], \ "Print"], Cell[BoxData[ \(". Get{System.Int32 UNNAMED}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". GetUpperBound{System.Int32 dimension}=> System.Int32"\)], \ "Print"], Cell[BoxData[ \(". GetValue{System.Int32 index1, System.Int32 index2, \ System.Int32 index3}=> System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int32 index1, System.Int32 index2}=> \ System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int32 index}=> System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int32[] indices}=> System.Object"\)], \ "Print"], Cell[BoxData[ \(". GetValue{System.Int64 index1, System.Int64 index2, \ System.Int64 index3}=> System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int64 index1, System.Int64 index2}=> \ System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int64 index}=> System.Object"\)], "Print"], Cell[BoxData[ \(". GetValue{System.Int64[] indices}=> System.Object"\)], \ "Print"], Cell[BoxData[ \(". Initialize{}=> System.Void"\)], "Print"], Cell[BoxData[ \(". SetAt{System.Int32 UNNAMED, System.Int32 UNNAMED}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". Set{System.Int32 UNNAMED, System.Int32 UNNAMED}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int32 index1, \ System.Int32 index2, System.Int32 index3}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int32 index1, \ System.Int32 index2}=> System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int32 index}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int32[] indices}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int64 index1, \ System.Int64 index2, System.Int64 index3}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int64 index1, \ System.Int64 index2}=> System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int64 index}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". SetValue{System.Object value, System.Int64[] indices}=> \ System.Void"\)], "Print"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* --------------- Examining Collections \ --------------- *)", "Subsection", FontSize->18]], "Subtitle"], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* ----- Values (Elements) of an Array ----- \ *)", "Subsection", FontSize->16]], "Subsection"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Elements\)\)\)\ of\ a\ Net\ Array . \ \(--\(---\)\); \ \[IndentingNewLine]Similar\ to\ "\<NETObjectToExpression\>", \ but\ using\ . NET\ functions; \[IndentingNewLine]Both\ to\ show\ how\ to\ \ use\ those\ functions, \[IndentingNewLine]and\ in\ preparation\ for\ \ building\ up\ a\ more\ complex\ \(\(displayer\)\(.\)\)\ \[IndentingNewLine]*) \)\(\[IndentingNewLine]\)\(NetArrayValues[\ netArray_\ ] := \[IndentingNewLine]TableZI[\ netArray@GetValue[\ #\ ] &, netArray@Length\ ];\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ \(NetArrayValues[\ nums\ ]\), "\[IndentingNewLine]", \(NetArrayValues[\ strings\ ]\)}], "Input"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"aardvark", "to", "zoology"}\), (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* ----- Array or Collection, Using \ IEnumerator ----- *)", "Subsection", FontSize->16]], "Subsection"], Cell[CellGroupData[{ Cell[BoxData[{ \(enum1 = nums@GetEnumerator[]\), "\[IndentingNewLine]", \(\(While[\ enum1@MoveNext[], \[IndentingNewLine]enum1@Current // Print\[IndentingNewLine]];\)\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Array+SZArrayEnumerator"] \[RightGuillemet]\), NETLink`Objects`NETObject$1241513985], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ \(11\)], "Print"], Cell[BoxData[ \(22\)], "Print"], Cell[BoxData[ \(33\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(\(--\(--\(-\ Enumerating\)\)\)\ \(\(Values\ --\)--\)\)\(-\)\ *) \)\ \(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\( (*\ First\ \(Approach : \ Working\ directly\ with\ . NET\ \(\(methods\)\(.\)\)\)\ *) \)\(\[IndentingNewLine]\ \)\(ListWhile[\ nums@GetEnumerator[], \((#@MoveNext[])\) &, \((#@ Current)\) &\ ]\[IndentingNewLine]\[IndentingNewLine] (*\ Second\ \(Alternate : \ make\ Mathematica\ Helper\ \(\(functions\)\(.\)\)\)\ \ *) \[IndentingNewLine] \(Current\[Bullet]N[\ enum_\ ] := enum@Current;\)\[IndentingNewLine] \(MoveNext\[Bullet]N[\ enum_\ ] := enum@MoveNext[];\)\[IndentingNewLine] ListWhile[\ nums@GetEnumerator[], MoveNext\[Bullet]N, Current\[Bullet]N\ ]\[IndentingNewLine]\[IndentingNewLine] (*\ Finally : \ make\ a\ function\ that\ does\ the\ whole\ \(\(task\)\(.\)\)\ \ *) \[IndentingNewLine] \(EnumerateValues[\ collection_\ ] := \[IndentingNewLine]ListWhile[\ collection@GetEnumerator[], MoveNext\[Bullet]N, Current\[Bullet]N\ ];\)\[IndentingNewLine]\ \[IndentingNewLine] EnumerateValues[\ nums\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(EnumerateValues[\ strings\ ]\)], "Input"], Cell[BoxData[ TagBox[\({"aardvark", "to", "zoology"}\), (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* ----- Keys of a Collection -----\nSome \ collections don't just contain values;\nthey access those values via \ keys.\nWhile it is possible to simply list the values using \ EnumerateValues, it would be nice to see which key selects which \ value.\n*)", "Subsection", FontSize->16]], "Subsection"], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\(-\ Array\)\)\ uses\ "\<.Length\>"\ and\ "\<.GetValue[ i \ ]\>", \ i\ in\ 0. . n - \(1. \ --\) - \ *) \)\(\[IndentingNewLine]\)\(nums\ \[IndentingNewLine] nums@GetValue[\ 0\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$100663297], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["11", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ KeyValuePair\[Bullet]ToString\)\)\), \(KeyValuePairs\ \[Bullet]ToStrings\ --\) \(---\)\ \ *) \)\(\[IndentingNewLine]\)\(\(KeyValuePair\[Bullet]ToString[\ \ {key_, value_}\ ] := \[IndentingNewLine]ToString[\ key\ ] <> "\<: \>" <> ToString[\ value\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(KeyValuePairs\[Bullet]ToStrings[\ kvPairs_\ ] := \[IndentingNewLine]Map[\ KeyValuePair\[Bullet]ToString, kvPairs\ ];\)\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Members\)\)\)\ of\ a\ Net\ Array, \ as\ key - value\ pairs . \ \(--\(---\)\)\ \ *) \)\(\[IndentingNewLine]\)\(\(NetArray\[Bullet]KeyValuePairs[\ netArray_\ ] := \[IndentingNewLine]TableZI[\ {#, netArray@GetValue[\ #\ ]} &, netArray@Length\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(NetArray\[Bullet]KeyValueStrings[\ netArray_\ ] \ := \[IndentingNewLine]KeyValuePairs\[Bullet]ToStrings[\ NetArray\[Bullet]KeyValuePairs[\ netArray\ ]\ ];\)\[IndentingNewLine]\[IndentingNewLine] NetArray\[Bullet]KeyValuePairs[\ nums\ ]\[IndentingNewLine] NetArray\[Bullet]KeyValueStrings[\ nums\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[\({{0, 11}, {1, 22}, {2, 33}}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"0: 11", "1: 22", "2: 33"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Members\)\)\)\ of\ a\ Net\ Collection, \ as\ key - value\ \(\(pairs\ --\)--\) - ; \[IndentingNewLine]RETURNS : \ \ {\ {key, value}, .. \ }\[IndentingNewLine]*) \)\(\ \[IndentingNewLine]\)\(\(NetCollection\[Bullet]KeyValuePairs[\ netColl_\ ] := \[IndentingNewLine]TableZI[\ {#, netColl@Item[\ #\ ]} &, netColl@Count\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(NetCollection\[Bullet]KeyValueStrings[\ netColl_\ ] \ := \[IndentingNewLine]KeyValuePairs\[Bullet]ToStrings[\ NetCollection\[Bullet]KeyValuePairs[\ netColl\ ]\ ];\)\)\)\)], "Input"], Cell[BoxData[ \(\(\( (*\ \(--\(--\(-\ Members\)\)\)\ of\ a\ Net\ IDictionary, \ as\ key - value\ pairs . \ \(--\(---\)\); \[IndentingNewLine]RETURNS : \ \ {\ {key, value}, .. \ }\[IndentingNewLine]*) \)\(\ \[IndentingNewLine]\)\(\(NetDictionary\[Bullet]KeyValuePairs[\ netDict_\ ] := \[IndentingNewLine]ListWhile[\ netDict@ GetEnumerator[], \((#@MoveNext[])\) &, {#@Key, #@ Value} &\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(NetDictionary\[Bullet]KeyValueStrings[\ netDict_\ ] \ := \[IndentingNewLine]KeyValuePairs\[Bullet]ToStrings[\ NetDictionary\[Bullet]KeyValuePairs[\ netDict\ ]\ ];\)\)\)\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* ----- Examining various collections ----- \ *)", "Subsection", FontSize->16]], "Subsection"], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\(-\ Make\)\)\ a\ NET\ List, \ so\ we\ can\ examine\ it . \ \(---\)\ \ *) \)\(\[IndentingNewLine]\)\(\(list1 = NETNew[\ "\<System.Collections.ArrayList\>", nums\ ];\)\n list1@Add[\ "\<The End\>"\ ]\[IndentingNewLine]\n NETObjectToExpression[\ list1\ ]\[IndentingNewLine] NetCollection\[Bullet]KeyValueStrings[\ list1\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox["3", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33, "The End"}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"0: 11", "1: 22", "2: 33", "3: The End"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(--\(-\ Make\)\)\ a\ NET\ Dictionary, \ so\ we\ can\ examine\ it . \ \(---\)\ \ *) \)\(\[IndentingNewLine]\)\(\(dict1 = NETNew[\ "\<System.Collections.Hashtable\>"\ ];\)\ \[IndentingNewLine] \(dict1@ Add[\ "\<a\>", "\<is for Alice\>"\ ];\)\[IndentingNewLine] \(dict1@Add[\ "\<z\>", "\<is for Zoey\>"\ ];\)\[IndentingNewLine] \(dict1@ Add[\ "\<s\>", "\<is for Stephanie\>"\ \ ];\)\[IndentingNewLine]\[IndentingNewLine] NETObjectToExpression[\ dict1\ ]\[IndentingNewLine] NetDictionary\[Bullet]KeyValueStrings[\ dict1\ ]\)\)\)], "Input"], Cell[BoxData[ TagBox[ RowBox[{"{", RowBox[{ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Collections.DictionaryEntry"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$2979700670465], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Collections.DictionaryEntry"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$2980002660353], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Collections.DictionaryEntry"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$2980153655297]}], "}"}], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"a: is for Alice", "s: is for Stephanie", "z: is for Zoey"}\), (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["(* ----- Copying To an Array -----\n", "Subsection", FontSize->16], "Technique: ICollection.CopyTo[ Array, 0 ].\nTherefore, need to \ build an array to receive the collection.\nNOTE: If the type of \ elements of the collection is known,\nthen build an array of that \ type.\nOtherwise, use the root type, \"Object\".\n\nTBD:\nBizarrely, \ Arrays do not implement \"ICollection.Count\",\nso they must be \ treated differently than other ICollections.\nMaybe test the type of \ the object, determine that it is an array,\ndo \"@Length\" instead.", StyleBox["\n*)", "Subsection", FontSize->16] }], "Subsection"], Cell[CellGroupData[{ Cell[BoxData[{ \(array1 = NETNew[\ "\<System.Object[]\>", list1@Count\ ]\), "\[IndentingNewLine]", \(array1@Length\), "\[IndentingNewLine]", \(NetArray\[Bullet]KeyValueStrings[\ array1\ ]\), "\[IndentingNewLine]", \(\(list1@CopyTo[\ array1\ ];\)\), "\[IndentingNewLine]", \(NetArray\[Bullet]KeyValueStrings[\ array1\ ]\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Object[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$1375731713], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["4", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"0: Null", "1: Null", "2: Null", "3: Null"}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"0: 11", "1: 22", "2: 33", "3: The End"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"(*", StyleBox[" ", FontFamily->"Arial"], StyleBox[\(\(--\(\(--\(-\ \(AsArray\ --\)\)\)--\)\)\(-\)\), FontFamily->"Arial", FontSize->16], " ", "*)"}], "\[IndentingNewLine]", \(\(AsArray\[Bullet]GivenName[\ netColl_, elemTypeName_String\ ] := \[IndentingNewLine]Module[\ \ {array}, \[IndentingNewLine]array = NETNew[\ elemTypeName <> "\<[]\>", netColl@Count\ ]; \[IndentingNewLine]array@ Length; \ \[IndentingNewLine]NetArray\[Bullet]KeyValueStrings[\ array\ ]; \[IndentingNewLine]netColl@ CopyTo[\ array\ ]; \ \[IndentingNewLine]array\[IndentingNewLine]];\)\[IndentingNewLine]\ \[IndentingNewLine] \(AsArray\[Bullet]GivenType[\ netColl_, elemType_\ ] \ := \[IndentingNewLine]AsArray\[Bullet]GivenName[\ netColl, elemType@ FullName\ ];\)\[IndentingNewLine]\[IndentingNewLine] \(AsArray[\ netColl_\ ] \ := \[IndentingNewLine]AsArray\[Bullet]GivenName[\ netColl, "\<System.Object\>"\ ];\)\)}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ \(AsArray[\ list1\ ]\), "\[IndentingNewLine]", \(% // NETObjectToExpression\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Object[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$1392508929], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33, "The End"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(\(list2 = NETNew[\ "\<System.Collections.ArrayList\>", nums\ ];\)\), "\[IndentingNewLine]", \(\(list2@Add[\ 999\ ];\)\), "\[IndentingNewLine]", \(AsArray\[Bullet]GivenType[\ list2, num@GetType[]\ ]\), "\[IndentingNewLine]", \(% // NETObjectToExpression\), "\[IndentingNewLine]", \(AsArray\[Bullet]GivenName[\ list2, "\<System.Int32\>"\ ]\), "\[IndentingNewLine]", \(% // NETObjectToExpression\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$1426063361], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33, 999}\), (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Int32[]"] \[RightGuillemet]\), NETLink`Objects`NETObject$1442840577], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({11, 22, 33, 999}\), (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["(* ========== Examples ========== *)", \ "Subsection", FontSize->18]], "Title"], Cell[BoxData[ \( (*\ HACK : \ Dummy\ code\ cell, \ so\ can\ "\<collapse\>"\ the\ following\ \(\(section\)\(.\)\)\ *) \ \)], "Input"], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["(* ----- Examine objects in nb#01-NetLink+CodeDom-Tests \ -----\n", "Subsection", FontSize->18], StyleBox["REQUIREMENT: First run nb#01 with net values exposed:\n\ comment out \"NETBlock[\" ... \"]\",\nand comment out the Module's \ local variable names \"assemblyName,..\".", "Subsection"], StyleBox["\n*)", "Subsection", FontSize->18] }], "Subtitle"], Cell[CellGroupData[{ Cell[BoxData[ \(\(If[\ statement1 // ValueQ, \[IndentingNewLine]lineDict1 = \((statement1@ Expression)\)@UserData; \[IndentingNewLine]lineDict1 // Print; \[IndentingNewLine]lineDict1@Count // Print; \[IndentingNewLine]\(lineDict1 // EnumerateValues\) // Print;, \[IndentingNewLine]\[IndentingNewLine]\("\<*** \ First run nb#01 with net values exposed.\>" // Print;\)\[IndentingNewLine]];\)\)], "Input"], Cell[BoxData[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Collections.Specialized.ListDictionary"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$1811939329]], "Print"], Cell[BoxData[ \(0\)], "Print"], Cell[BoxData[ \({}\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ CAUTION : \ This\ is\ actually\ a\ CodeDomType, \ not\ a\ \(\(NetType\)\(.\)\)\ \ *) \)\(\[IndentingNewLine]\)\(netType1\[IndentingNewLine] netType1@ToString[]\[IndentingNewLine] netType1@\(GetType[]@FullName\)\[IndentingNewLine] netType1@\(GetType[]@BaseType\)\[IndentingNewLine] netType1@Name\)\)\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeTypeDeclaration"] \[RightGuillemet]\), NETLink`Objects`NETObject$1577058305], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.CodeDom.CodeTypeDeclaration\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"System.CodeDom.CodeTypeDeclaration\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.RuntimeType"] \[RightGuillemet]\), NETLink`Objects`NETObject$1991986303205377], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"HelloWorldMsgApp\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \(\(CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ netType1\ ];\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(CodeDomType\[Bullet]TypeAndName\[Bullet]String[\ netType1\ ]\)], "Input"], Cell[BoxData[ TagBox["\<\"System.CodeDom.CodeTypeDeclaration HelloWorldMsgApp\"\ \>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\( (*\ \(Map[\ Print[\ MethInfo\[Bullet]String[\ #\ ]\ ] &, \ \[IndentingNewLine]\((netType1@\(GetType[]@ GetMethods[]\))\)\ ];\)\ *) \)\(\[IndentingNewLine]\)\ \(\[IndentingNewLine]\)\(PrintParts[\[IndentingNewLine]Sort[\ CodeDomType\[Bullet]MethInfo\[Bullet]Strings[\ netType1\ ]\ ], \ \[IndentingNewLine]CodeDomType\[Bullet]TypeAndName\[Bullet]String[\ netType1\ ] <> "\<:\n. Methods:\>", "\<. . \>"\ \ ];\)\)\)], "Input"], Cell[BoxData[ \("System.CodeDom.CodeTypeDeclaration HelloWorldMsgApp:\n. \ Methods:"\)], "Print"], Cell[BoxData[ \(". . add_PopulateBaseTypes{System.EventHandler value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . add_PopulateMembers{System.EventHandler value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . Equals{System.Object obj}=> System.Boolean"\)], "Print"], Cell[BoxData[ \(". . get_Attributes{}=> System.CodeDom.MemberAttributes"\)], \ "Print"], Cell[BoxData[ \(". . get_BaseTypes{}=> \ System.CodeDom.CodeTypeReferenceCollection"\)], "Print"], Cell[BoxData[ \(". . get_Comments{}=> \ System.CodeDom.CodeCommentStatementCollection"\)], "Print"], Cell[BoxData[ \(". . get_CustomAttributes{}=> \ System.CodeDom.CodeAttributeDeclarationCollection"\)], "Print"], Cell[BoxData[ \(". . GetHashCode{}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". . get_IsClass{}=> System.Boolean"\)], "Print"], Cell[BoxData[ \(". . get_IsEnum{}=> System.Boolean"\)], "Print"], Cell[BoxData[ \(". . get_IsInterface{}=> System.Boolean"\)], "Print"], Cell[BoxData[ \(". . get_IsStruct{}=> System.Boolean"\)], "Print"], Cell[BoxData[ \(". . get_LinePragma{}=> System.CodeDom.CodeLinePragma"\)], \ "Print"], Cell[BoxData[ \(". . get_Members{}=> \ System.CodeDom.CodeTypeMemberCollection"\)], "Print"], Cell[BoxData[ \(". . get_Name{}=> System.String"\)], "Print"], Cell[BoxData[ \(". . get_TypeAttributes{}=> \ System.Reflection.TypeAttributes"\)], "Print"], Cell[BoxData[ \(". . GetType{}=> System.Type"\)], "Print"], Cell[BoxData[ \(". . get_UserData{}=> System.Collections.IDictionary"\)], \ "Print"], Cell[BoxData[ \(". . remove_PopulateBaseTypes{System.EventHandler value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . remove_PopulateMembers{System.EventHandler value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . set_Attributes{System.CodeDom.MemberAttributes value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . \ set_CustomAttributes{System.CodeDom.\ CodeAttributeDeclarationCollection value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". . set_IsClass{System.Boolean value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". . set_IsEnum{System.Boolean value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". . set_IsInterface{System.Boolean value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". . set_IsStruct{System.Boolean value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". . set_LinePragma{System.CodeDom.CodeLinePragma value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". . set_Name{System.String value}=> System.Void"\)], "Print"], Cell[BoxData[ \(". . set_TypeAttributes{System.Reflection.TypeAttributes \ value}=> System.Void"\)], "Print"], Cell[BoxData[ \(". . ToString{}=> System.String"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(EnumProperties[\ lineDict1\ ]\), "\[IndentingNewLine]", \(Map[\ Length[\ #@GetIndexParameters[]\ ] &, EnumProperties[\ lineDict1\ ]\ ]\)}], "Input"], Cell[BoxData[ TagBox[ RowBox[{"{", RowBox[{ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992433289330689], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992434027528193], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992434765725697], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992435503923201], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992436242120705], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992436980318209], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992437718515713], ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.Reflection.RuntimePropertyInfo"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$3992438456713217]}], "}"}], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({1, 0, 0, 0, 0, 0, 0, 0}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(statement1\)], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeExpressionStatement"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$1644167169], (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ lineDict1, "\<lineDict1\>"\ ]\)], "Input"], Cell[BoxData[ \("System.Collections.Specialized.ListDictionary lineDict1: \ Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". Count <System.Int32>: 0"\)], "Print"], Cell[BoxData[ \(". IsFixedSize <System.Boolean>: False"\)], "Print"], Cell[BoxData[ \(". IsReadOnly <System.Boolean>: False"\)], "Print"], Cell[BoxData[ \(". IsSynchronized <System.Boolean>: False"\)], "Print"], Cell[BoxData[ \(". Item <System.Object>: ***needs param(s)***"\)], "Print"], Cell[BoxData[ \(". Keys <System.Collections.ICollection>: \ <<NETObject[System.Collections.Specialized.ListDictionary+\ NodeKeyValueCollection]>>"\)], "Print"], Cell[BoxData[ \(". SyncRoot <System.Object>: \ <<NETObject[System.Collections.Specialized.ListDictionary]>>"\)], \ "Print"], Cell[BoxData[ \(". Values <System.Collections.ICollection>: \ <<NETObject[System.Collections.Specialized.ListDictionary+\ NodeKeyValueCollection]>>"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ statement1, "\<statement1\>"\ ]\)], "Input"], Cell[BoxData[ \("System.CodeDom.CodeExpressionStatement statement1: Selected \ Property Values:"\)], "Print"], Cell[BoxData[ \(". Expression <System.CodeDom.CodeExpression>: \ <<NETObject[System.CodeDom.CodeSnippetExpression]>>"\)], "Print"], Cell[BoxData[ \(". LinePragma <System.CodeDom.CodeLinePragma>: ***needs \ param(s)***"\)], "Print"], Cell[BoxData[ \(". UserData <System.Collections.IDictionary>: \ <<NETObject[System.Collections.Specialized.ListDictionary]>>"\)], \ "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValues[\ statement1@ Expression, "\<statement1@Expression\>"\ ]\)], "Input"], Cell[BoxData[ \("System.CodeDom.CodeSnippetExpression statement1@Expression: \ Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". UserData <System.Collections.IDictionary>: \ <<NETObject[System.Collections.Specialized.ListDictionary]>>"\)], \ "Print"], Cell[BoxData[ \(". Value <System.String>: MessageBox.Show( \"Hello, .NET World!\ \" )"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(statement1@\(Expression@Value\)\)], "Input"], Cell[BoxData[ TagBox["\<\"MessageBox.Show( \\\"Hello, .NET World!\\\" )\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Print\[Bullet]PropValuesAndMethods[\ spaceTypes1, "\<spaceTypes1\>"\ ]\)], "Input"], Cell[BoxData[ \("spaceTypes1: System.CodeDom.CodeTypeDeclarationCollection"\)], \ "Print"], Cell[BoxData[ \("System.CodeDom.CodeTypeDeclarationCollection spaceTypes1: \ Selected Property Values:"\)], "Print"], Cell[BoxData[ \(". Count <System.Int32>: 1"\)], "Print"], Cell[BoxData[ \(". Item <System.CodeDom.CodeTypeDeclaration>: ***needs \ param(s)***"\)], "Print"], Cell[BoxData[ \("System.CodeDom.CodeTypeDeclarationCollection spaceTypes1: \ Methods:"\)], "Print"], Cell[BoxData[ \(". AddRange{System.CodeDom.CodeTypeDeclarationCollection \ value}=> System.Void"\)], "Print"], Cell[BoxData[ \(". AddRange{System.CodeDom.CodeTypeDeclaration[] value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". Add{System.CodeDom.CodeTypeDeclaration value}=> \ System.Int32"\)], "Print"], Cell[BoxData[ \(". Clear{}=> System.Void"\)], "Print"], Cell[BoxData[ \(". Contains{System.CodeDom.CodeTypeDeclaration value}=> \ System.Boolean"\)], "Print"], Cell[BoxData[ \(". CopyTo{System.CodeDom.CodeTypeDeclaration[] array, \ System.Int32 index}=> System.Void"\)], "Print"], Cell[BoxData[ \(". get_Count{}=> System.Int32"\)], "Print"], Cell[BoxData[ \(". GetEnumerator{}=> System.Collections.IEnumerator"\)], \ "Print"], Cell[BoxData[ \(". get_Item{System.Int32 index}=> \ System.CodeDom.CodeTypeDeclaration"\)], "Print"], Cell[BoxData[ \(". IndexOf{System.CodeDom.CodeTypeDeclaration value}=> \ System.Int32"\)], "Print"], Cell[BoxData[ \(". Insert{System.Int32 index, \ System.CodeDom.CodeTypeDeclaration value}=> System.Void"\)], \ "Print"], Cell[BoxData[ \(". RemoveAt{System.Int32 index}=> System.Void"\)], "Print"], Cell[BoxData[ \(". Remove{System.CodeDom.CodeTypeDeclaration value}=> \ System.Void"\)], "Print"], Cell[BoxData[ \(". set_Item{System.Int32 index, \ System.CodeDom.CodeTypeDeclaration value}=> System.Void"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(NetCollection\[Bullet]KeyValuePairs[\ spaceTypes1\ ]\), "\[IndentingNewLine]", \(NetCollection\[Bullet]KeyValueStrings[\ spaceTypes1\ ]\)}], "Input"], Cell[BoxData[ TagBox[ RowBox[{"{", RowBox[{"{", RowBox[{"0", ",", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeTypeDeclaration"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$1577058305]}], "}"}], "}"}], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"0: <<NETObject[System.CodeDom.CodeTypeDeclaration]>>"}\ \), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ \(spaceTypes1\), "\[IndentingNewLine]", \(EnumerateValues[\ spaceTypes1\ ]\), "\[IndentingNewLine]", \(type1 = \(EnumerateValues[\ spaceTypes1\ ]\)\[LeftDoubleBracket]\ 1\ \[RightDoubleBracket]\), "\[IndentingNewLine]", \(type1@Name\), "\[IndentingNewLine]", \(Map[\ \((#@Name)\) &, EnumerateValues[\ spaceTypes1\ ]\ ]\)}], "Input"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeTypeDeclarationCollection"] \ \[RightGuillemet]\), NETLink`Objects`NETObject$1476395009], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ RowBox[{"{", InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeTypeDeclaration"] \[RightGuillemet]\ \), NETLink`Objects`NETObject$1577058305], "}"}], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[ InterpretationBox[\(\[LeftGuillemet]NETObject[ "System.CodeDom.CodeTypeDeclaration"] \[RightGuillemet]\), NETLink`Objects`NETObject$1577058305], (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox["\<\"HelloWorldMsgApp\"\>", (Short[ #, 50]&)]], "Output"], Cell[BoxData[ TagBox[\({"HelloWorldMsgApp"}\), (Short[ #, 50]&)]], "Output"] }, Open ]], Cell[BoxData[ \( (*Print\[Bullet]PropValuesAndMethods[\ type1, "\<type1\>"\ ]*) \)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \("\<spaceTypes1\>" <> "\< <\>" <> spaceTypes1@\(GetType[]@Name\) <> "\<>: \>" <> ToString[\ Map[\ \((#@Name)\) &, EnumerateValues[\ spaceTypes1\ ]\ ]\ ]\)], "Input"], Cell[BoxData[ TagBox["\<\"spaceTypes1 <CodeTypeDeclarationCollection>: \ {HelloWorldMsgApp}\"\>", (Short[ #, 50]&)]], "Output"] }, Open ]] }, Closed]] }, Open ]] }, FrontEndVersion->"5.0 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 976}}, WindowSize->{636, 845}, WindowMargins->{{Automatic, 4}, {Automatic, 5}} ]