How to create instances at runtime (IKVM.Reflection)
Jörg Taubert <[email protected]> Mon, 23 Jan 2017 12:24:47 +0100
| Newsgroups | gmane.comp.java.ikvm.devel |
|---|---|
| Organization | MasterSoft GmbH |
| Message-ID | <[email protected]> |
This is a multipart message in MIME format.
--===============5375108577626473815==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0005_01D27573.AFD9A190"
Content-Language: de
This is a multipart message in MIME format.
------=_NextPart_000_0005_01D27573.AFD9A190
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
=20
is there a way to create instances at runtime using IKVM.Reflection?
I would like to replace the following code with the parameter =84type=93 =
of type
IKVM.Reflection.Type instead of System.Type.
=20
Parameters:
IKVM.Reflection.Type type
int[] arrayDimensions
=20
var instance =3D arrayDimensions !=3D null
? Array.CreateInstance(type, arrayDimensions)
: Activator.CreateInstance(type);
=20
Friendly regards
Joerg
------=_NextPart_000_0005_01D27573.AFD9A190
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-microsoft-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=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1"><meta name=3DGenerator 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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
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 Vorformatiert Zchn";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
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;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 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=3DDE =
link=3D"#0563C1" vlink=3D"#954F72"><div class=3DWordSection1><p =
class=3DMsoNormal>Hello,<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>is there a =
way to create instances at runtime using =
IKVM.Reflection?<o:p></o:p></p><p class=3DMsoNormal>I would like to =
replace the following code with the parameter „type“ of type =
IKVM.Reflection.Type instead of System.Type.<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>Parameters:<o:p></o:p></p><p =
class=3DMsoNormal><i>IKVM.Reflection.Type</i> type<o:p></o:p></p><p =
class=3DMsoNormal><i>int[]</i> arrayDimensions<o:p></o:p></p><p =
class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>var instance =3D arrayDimensions !=3D=
null<o:p></o:p></p><p =
class=3DMsoNormal> ? Array.CreateInstance(typ=
e, arrayDimensions)<o:p></o:p></p><p =
class=3DMsoNormal> : Activator.CreateInstance=
(type);<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>Friendly regards<o:p></o:p></p><p =
class=3DMsoNormal>Joerg<o:p></o:p></p></div></body></html>
------=_NextPart_000_0005_01D27573.AFD9A190--
--===============5375108577626473815==
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
--===============5375108577626473815==
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
--===============5375108577626473815==--