C# -> VB: Type members in a module cannot be shared
See original GitHub issueInput code
static partial class SpecializedCollections
{
public static readonly byte[] EmptyBytes = EmptyArray<byte>();
public static readonly object[] EmptyObjects = EmptyArray<object>();
}
Erroneous output
Partial Module SpecializedCollections
Public Shared ReadOnly EmptyBytes As Byte() = EmptyArray(Of Byte)()
Public Shared ReadOnly EmptyObjects As Object() = EmptyArray(Of Object)()
End Module
Expected output
Partial Module SpecializedCollections
Public ReadOnly EmptyBytes As Byte() = EmptyArray(Of Byte)()
Public ReadOnly EmptyObjects As Object() = EmptyArray(Of Object)()
End Module
Details
The example shows fields, but applies to anything declared in a module.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
vb.net - Is a Module really identical to a SharedMembers- ...
The VB equivalent is Shared , but Shared Classes are not permited with VB (only the Members). The guidelines described below are tentatives...
Read more >Shared - Visual Basic
Sharing a member of a class or structure makes it available to every instance, rather than non-shared, where each instance keeps its own ......
Read more >Type members
This chapter defines members of types. Members include methods, properties, fields, delegates, and events.
Read more >Shared classes or modules? - Visual Basic .NET
it. I normally prefer "Shared" classes over Modules as they require the class name to prefix the member names, which to me is...
Read more >Thread: Sub Main in Module vs Shared Class
A module is internally a class where all members are declared 'Shared' So there's no practical difference between a class where you declare ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also, module constructors cannot be private.
Apologies for the confusion. I wasn’t talking about project specific stuff, just standard Visual Studio build workflow. Fortunately VS has extensive documentation and articles on getting started, so you can just Google:
Tests\VB\MemberTests.cs
While this is a “trivial bug” in the sense that a sequence of small understandable steps will solve it, it will require quite a few changes, and some careful reading of the C# and VB documentation. I tagged it “good first issue” because there’s something else to copy the style of (the conversion in the other direction), not because it’s inherently easy.
While you’re getting used to the development environment too I’d probably recommend starting on the other issue I’ve just tagged here which is a bit smaller.
Hope that helps!