Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Not true. </p> <p>I understand your question to be asking about <a href="http://msdn.microsoft.com/en-us/library/f07c8z1c.aspx" rel="noreferrer">COM calling or using a .NET class</a>. </p> <p>According to <a href="http://msdn.microsoft.com/en-us/library/zsfww439.aspx" rel="noreferrer">this page</a>, you can expose methods, properties and fields of managed classes to COM consumers.</p> <blockquote> <p>All managed types, methods, properties, fields, and events that you want to expose to COM must be public. Types must have a public default constructor, which is the only constructor that can be invoked through COM. </p> </blockquote> <p>Does this work for you?: </p> <pre><code>[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [Guid("A1209192-723B-4325-8599-FB39D9F202D9")] public interface ITicklee { [DispId(1)] void TickleMe(); [DispId(2)] int Count{get;} } [Guid("45715A3B-CA95-49f7-9889-A0022B31EF8A")] public class Elmo : ITicklee { // default ctor public Elmo () {} private int _tickleCount; public int Count { get { return _tickleCount; } } public void TickleMe() { _tickleCount++; } } </code></pre> <p>A VBScript test client might look like this:</p> <pre><code>Sub TestTickle() WScript.echo("") WScript.echo("Instantiating an Elmo ...") dim elmo set elmo = WScript.CreateObject("Ionic.Tests.Com.Elmo") WScript.echo("Tickling...") For i = 1 to 5 elmo.TickleMe() Next WScript.echo("") c = elmo.Count WScript.echo("Tickle Count = " &amp; c) ' one for the road' elmo.TickleMe() End Sub call TestTickle() ' ahem ' </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload