<assembly: AssemblyKeyFile("Delphi.snk")> Namespace Delphi Public Class Test Public Function Dup(s As String, n As Integer) As String Dim res As String = "" Dim i As Integer For i = 1 To n res = res & s Next Dup = res End Function End Class End Namespace
Delphi kode:
program d_vb;
{$APPTYPE CONSOLE}
uses ActiveX, ComObj;
var tst : Variant;
begin CoInitialize(nil); tst := CreateOLEObject('Delphi.Test'); writeln(tst.Dup('ABC', 3)); CoUninitialize; readln; end.
Imports System Imports System.Reflection Imports System.Runtime.InteropServices
<assembly: AssemblyKeyFile("Delphi.snk")> Namespace Delphi <Guid("4A855566-3146-40dc-A226-45570F86FD0B"),InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> Public Interface ITest <DispId(1)> Function Dup(s As String, n As Integer) As String End Interface <Guid("F87E97F4-8B5F-4761-BBE4-13512B9BA03B"),ClassInterface(ClassInterfaceType.None),ProgId("Delphi.Test")> Public Class Test Implements ITest Public Function Dup(s As String, n As Integer) As String Implements ITest.Dup Dim res As String = "" Dim i As Integer For i = 1 To n res = res & s Next Dup = res End Function End Class End Namespace
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.