Re: How to create instances at runtime (IKVM.Reflection)

Jeroen Frijters <[email protected]> Mon, 23 Jan 2017 17:24:30 +0000
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <AM2PR08MB0051C12034E2F3E8577BF58EA2720@AM2PR08MB0051.eurprd08.prod.outlook.com>
--===============6643964559628885637==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_AM2PR08MB0051C12034E2F3E8577BF58EA2720AM2PR08MB0051eurp_"

--_000_AM2PR08MB0051C12034E2F3E8577BF58EA2720AM2PR08MB0051eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

No, the whole point of IKVM.Reflection is to be completely decoupled from t=
he runtime.

From: J=F6rg Taubert [mailto:[email protected]]
Sent: Monday, January 23, 2017 12:25
To: [email protected]
Subject: [Ikvm-developers] How to create instances at runtime (IKVM.Reflect=
ion)

Hello,

is there a way to create instances at runtime using IKVM.Reflection?
I would like to replace the following code with the parameter "type" of typ=
e IKVM.Reflection.Type instead of System.Type.

Parameters:
IKVM.Reflection.Type type
int[] arrayDimensions

var instance =3D arrayDimensions !=3D null
    ? Array.CreateInstance(type, arrayDimensions)
    : Activator.CreateInstance(type);

Friendly regards
Joerg

--_000_AM2PR08MB0051C12034E2F3E8577BF58EA2720AM2PR08MB0051eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
p.HTMLVorformatiert, li.HTMLVorformatiert, div.HTMLVorformatiert
	{mso-style-name:"HTML Vorformatiert";
	mso-style-link:"HTML Vorformatiert Zchn";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.HTMLVorformatiertZchn
	{mso-style-name:"HTML Vorformatiert Zchn";
	mso-style-priority:99;
	mso-style-link:"HTML Vorformatiert";
	font-family:"Courier New";
	mso-fareast-language:DE;}
span.EmailStyle23
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:70.85pt 70.85pt 56.7pt 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">No, the whole point of IKVM.Reflection is to be comp=
letely decoupled from the runtime.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div style=3D"border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt">
<div>
<div style=3D"border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal"><b>From:</b> J=F6rg Taubert [mailto:Joerg.Taubert@ma=
stersoft-gmbh.de]
<br>
<b>Sent:</b> Monday, January 23, 2017 12:25<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> [Ikvm-developers] How to create instances at runtime (IKVM.=
Reflection)<o:p></o:p></p>
</div>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span lang=3D"DE">Hello,<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">is there a way to create instances=
 at runtime using IKVM.Reflection?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">I would like to replace the follow=
ing code with the parameter &#8222;type&#8220; of type IKVM.Reflection.Type=
 instead of System.Type.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">Parameters:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><i><span lang=3D"DE">IKVM.Reflection.Type</span></i>=
<span lang=3D"DE"> type<o:p></o:p></span></p>
<p class=3D"MsoNormal"><i><span lang=3D"DE">int[]</span></i><span lang=3D"D=
E"> arrayDimensions<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">var&nbsp;instance&nbsp;=3D&nbsp;ar=
rayDimensions&nbsp;!=3D&nbsp;null<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">&nbsp;&nbsp;&nbsp;&nbsp;?&nbsp;Arr=
ay.CreateInstance(type,&nbsp;arrayDimensions)<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Act=
ivator.CreateInstance(type);<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"DE">Friendly regards<o:p></o:p></span>=
</p>
<p class=3D"MsoNormal"><span lang=3D"DE">Joerg<o:p></o:p></span></p>
</div>
</div>
</body>
</html>

--_000_AM2PR08MB0051C12034E2F3E8577BF58EA2720AM2PR08MB0051eurp_--


--===============6643964559628885637==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--===============6643964559628885637==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

--===============6643964559628885637==--