Abstract class / method like C # & # 8594; Vb.net

I am more familiar with VB, and the book I bought has C # examples, now I'm stuck.

How to implement the following in VB.NET?

public abstract class ENTBaseDATA<T> where T : IENTBaseEntity { public abstract List<T> Select(); public abstract T Select(int id); etc....This code already is converted :) } 

See the full code in chapter 2:

http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470396865,descCd-DOWNLOAD.html

+6
generics abstract-class
source share
3 answers

You can try using the C # / VB.NET converter . Exit:

 Public MustInherit Class ENTBaseDATA(Of T As IENTBaseEntity)  Public MustOverride Function [Select]() As List(Of T)  Public MustOverride Function [Select](ByVal id As Integer) As T  ' and then the other code ' End Class 
+13
source share

You must know:

Abstract class:

In C #: abstract keyword

In VB.NET: MustInherit Keyword

Abstract Method:

In C #: abstract keyword

In VB.NET: MustOverride Keyword

General class or method:

In C #: Class<T> where T : Conditions

In VB.NET: Class(Of T As Conditions)

Finally, in VB.NET, the word Select is a reserved keyword, so you need to enclose it between [] to use it.

+12
source share

You can check out some auto converter, fe. http://www.kamalpatel.net/ConvertCSharp2VB.aspx . If this does not work, you can: create an assembly in C # (just compile your code), load .NET Reflector (if you donโ€™t have one! :)), decompile the assembly and convert it to VB.NET

// Edit the remote code as if it were broken (eh, those converters;)).

0
source share

All Articles