JL.
JL.

Reputation: 81262

Can I call a vb.net dll from a c#.net dll?

Simple yes/no question : Can I call a vb.net function compiled in a vb.net dll from a c# function compiled in its own C# dll? Running in the same application.

Upvotes: 0

Views: 296

Answers (6)

tphelps
tphelps

Reputation: 1

It depends on the access modifier of the class and its method/function. Below is a list of access modifiers (C# / VB.Net) and the external availability.

public / Public - Yes
protected / Protected - Must be inherited and the subclass can be used.
internal / Private - No
protected internal / Friend - No
private / Protected Friend - No

Upvotes: 0

Surya sasidhar
Surya sasidhar

Reputation: 30293

yes, why because .net is language interoperability.

Upvotes: 1

Mike Hanson
Mike Hanson

Reputation: 1089

The whole point of .NET is interoperability. Therefore, all .NET language assemblies should be able to call back and forth to other .NET assemblies, with a few very specific caveats, as noted by Pete.

Upvotes: 5

Pete OHanlon
Pete OHanlon

Reputation: 9146

Yes you can. The other way round isn't necessarily true because you can do things in C# that aren't CLS Compliant, hence the reason you need to mark C# assemblies with

[assembly:CLSCompliant(true)]

Upvotes: 13

Himadri
Himadri

Reputation: 8876

Yes ofcourse. You can access the dll and can create objects of classes in the dll and call methods.

Upvotes: 4

Eric Minkes
Eric Minkes

Reputation: 1431

Yes, that shouldn't be a problem.

Upvotes: 8

Related Questions