Not sure what your asking
Imports System Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.ApplicationServices.DocumentExten
sion <Assembly: CommandClass(GetType(AutoCAD_VB_plug_in1.MyCommand s))> Namespace AutoCAD_VB_plug_in1 Public Class MyCommands <CommandMethod("MyCommand")> _ Public Sub MyCommand() Dim doc As Document = Application.DocumentManager.MdiActiveDocument doc.CloseAndDiscard() End Sub End Class End Namespace
The doc you quote relate to defining/implementing extension methods in VB, not consumign them from VB.
There does seem to be a problem with consumig those methods as extension methods in VB.NET, and it may have something to do with the fact that both containing type and the methods themselves require the ExtensionAttribute.
I know that, Alexander. I was asking about the module for VB.
There is no module to import.
You are looking at docs that relate to defining extension methods in VB.NET, not consuming extension methods from an assembly.
You should only have to import the namespace containing the type that exposes the extension methods, but as I mentioned in my other reply, there seems to be a problem there, as when I tried with the required assembly reference and namespace import, the VB code compiler couldn't find the extension method.
@DiningPhilosopher: Exactly, that's what I am trying to say. It doesn't work as extension method for VB. I quoted the docs for defining the extension method, because I wanted to point out, that there might be a problem. If you reference the same class from VB and C# it's not compatible.
@Jeff: This is what I would expect, but it doesn't work for me.
In a VB project if I reference a fully managed assembly written in C# with extension methods all I have to do is import the namespace and shows up in intellisense and what not.
I just was referring to a library of extension methods written in C# that I referenced into new VB project to test quickly.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.