Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Does performance reduces if i use always Public Sub or Sub instead of Private Sub?

Does performance reduces if i use always Public Sub or Sub instead of Private Sub?

Scheduled Pinned Locked Moved Visual Basic
performancehelptutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ninkk
    wrote on last edited by
    #1

    Hi, i have a project in which i mostly use Public Sub or Sub declaration because i am used to it. Most of those subs, could have been actually even Private Sub. Do i gain something if i change those subs(public subs or subs) and make it private sub in performance issue(for example memory)? thanks in advance...

    M N K 3 Replies Last reply
    0
    • N ninkk

      Hi, i have a project in which i mostly use Public Sub or Sub declaration because i am used to it. Most of those subs, could have been actually even Private Sub. Do i gain something if i change those subs(public subs or subs) and make it private sub in performance issue(for example memory)? thanks in advance...

      M Offline
      M Offline
      Mark Churchill
      wrote on last edited by
      #2

      No difference in memory or performance. This is a design issue, not a performance one.

      Mark Churchill Director Dunn & Churchill Free Download:
      Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.

      1 Reply Last reply
      0
      • N ninkk

        Hi, i have a project in which i mostly use Public Sub or Sub declaration because i am used to it. Most of those subs, could have been actually even Private Sub. Do i gain something if i change those subs(public subs or subs) and make it private sub in performance issue(for example memory)? thanks in advance...

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        No differences in performance. But if you are making everything public, you are breaking the OO rules. So only expose the needed methods/properties to the outside than exposing everything.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        1 Reply Last reply
        0
        • N ninkk

          Hi, i have a project in which i mostly use Public Sub or Sub declaration because i am used to it. Most of those subs, could have been actually even Private Sub. Do i gain something if i change those subs(public subs or subs) and make it private sub in performance issue(for example memory)? thanks in advance...

          K Offline
          K Offline
          Khatri Mitesh
          wrote on last edited by
          #4

          Public declaration not effect the performance but it is not a good programming to declare all variable and member declare public. Thanx ~ Khatri Mitesh

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups