It turns out you cant' cut and paste the GUI from the tutorial doc to the VB Express IDE. I deleted the New Guid parameter and put it in manually.
New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"
It compiles and load but when I try to execute the function I get an error message
combin(5,3)=
Unable to cast object
of type 'SMath.Manager.Term'
to type 'Systems.Collection.Generic.IEnumerable`1[SMath.Manager.Term]'
My source code is listed below.
Imports SMath.Manager
Imports SMath.Math
Public Class Class1
Implements IPluginHandleEvaluation, IPluginLowLevelEvaluation
Dim termInfos() As TermInfo
Dim asseblyInfos() As AssemblyInfo
Public ReadOnly Property Dependences As SMath.Manager.AssemblyInfo() Implements SMath.Manager.IPlugin.Dependences
Get
Return Me.asseblyInfos
End Get
End Property
Public Sub Initialize() Implements SMath.Manager.IPlugin.Initialize
Me.termInfos = New TermInfo() {
New TermInfo("combin", TermType.Function, 2, "(n, k) ‐ Returns the number of subsets (combinations) of k elements that can be formed from n elements.", FunctionSection.Unknown, True)
}
Me.asseblyInfos = New AssemblyInfo() {
New AssemblyInfo("Smath Studio", New Version(0, 88), New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"
)
}
End Sub
Public ReadOnly Property TermsHandled As SMath.Manager.TermInfo() Implements SMath.Manager.IPluginHandleEvaluation.TermsHandled
Get
Return Me.termInfos
End Get
End Property
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region
Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements SMath.Manager.IPluginLowLevelEvaluation.ExpressionEvaluation
If root.Type = TermType.Function And root.Text = "combin" And root.ChildCount = 2 Then
Dim arg1 As Term() = Decision.Preprocessing(args(0), store)
Dim arg2 As Term() = Decision.Preprocessing(args(1), store)
Dim answer As New List(Of Term)
answer.AddRange(arg1)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg1)
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Substraction, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(New Term([Operator].Multiplication, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Division, TermType.Operator, 2))
result = answer.ToArray()
Return True
End If
Return False
End Function
End Class
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Combinations Function"
>
<Assembly: AssemblyDescription("Plugin with Combinations function realization"
>
<Assembly: AssemblyCompany("Andrey Ivashov"
>
<Assembly: AssemblyProduct("Combinations Function"
>
<Assembly: AssemblyCopyright("Copyright © SMath 2010"
>
<Assembly: AssemblyTrademark(""
>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("a37cba83-b69c-9992-55ff666763bd"
>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*"
>
<Assembly: AssemblyVersion("1.0.*"
>
<Assembly: AssemblyFileVersion("1.0.*"
>