@maszrum: Ślicznie dziękuję, to mi w zupełności wystarczy. Czyli całość by wyglądała tak:
Klasa statyczna:
namespace bibliotekaTestowaDoZaladowania
{
public struct S1
{
public Point3d p1;
public S1( Point3d p )
{
p1 = p;
}
}
public static class klasaTestowa
{
public static Point3d metoda1( S1 s )
{
return s.p1;
}
public static S1 metoda2( S1 s, double mnoznik )
{
return new S1( new Point3d( s.p1.X * mnoznik, s.p1.Y * mnoznik, s.p1.Z * mnoznik ) );
}
}
}
kod wywołujący obydwie metody:
byte[] daneWe = File.ReadAllBytes( sciezkaDll );
Assembly DLL = Assembly.Load( daneWe );
Type tKlasy = DLL.GetType( "bibliotekaTestowaDoZaladowania.klasaTestowa" );
Type tStruktury = DLL.GetType( "bibliotekaTestowaDoZaladowania.S1" );
Object[] argKonstrStrukt1 = { new Point3d( 1, 2, 3 ) };
Object obiektStruktury1 = Activator.CreateInstance( tStruktury, argKonstrStrukt1 );
Object[] argMet1 = { obiektStruktury1 };
MethodInfo metoda1 = tKlasy.GetMethod( "metoda1", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public );
Point3d p = ( Point3d )metoda1.Invoke( null, new object[] { obiektStruktury1 } );
MethodInfo metoda2 = tKlasy.GetMethod( "metoda2" );
Object[] argMet2 = { obiektStruktury1, 0.5 };
Object s = metoda2.Invoke( null, argMet2 );
FieldInfo p1FieldInfo = tStruktury.GetField( "p1" );
Point3d p1 = ( Point3d )p1FieldInfo.GetValue( s );