Shared Class With No Need for New Instances


/ Published in: VB.NET
Save to your folder(s)

Use this method to create a class that doesn't need to be declared new to return properties


Copy this code and paste it in your HTML
  1. public class BuddyClass
  2. public shared Age as integer = 99
  3.  
  4. public shared function IsAlive() as boolean
  5. return true
  6. end function
  7. end Class
  8.  
  9.  
  10. can use this class like this:
  11. BuddyClass.Age
  12. BuddyClass.IsAlive
  13.  
  14. no need to do:
  15. new BuddyClass

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.