- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the equivalent of a VB module in C#?
In VB, a module is used to store loose code accessible from elsewhere in the application without having to first initialize something.
The state of the variable can be easily set or changed and that continues to carry on that value throughout.
For the same work in C#< use a static class.
Let us see an example −
VB
Module MyModule Public Sub Display MsgBox("Demo!") End Sub End Module
C#
public static class Display { public static void DisplayMethod() { Console.WriteLine("Demo!"); } }
Advertisements