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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Using Flush and Dispose on grapichs object !

Using Flush and Dispose on grapichs object !

Scheduled Pinned Locked Moved C#
graphicsdata-structures
2 Posts 2 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.
  • H Offline
    H Offline
    Hussam Fattahi
    wrote on last edited by
    #1

    if we create an Graphics object named graph, use it to draw shap or any other thing. what would happen if i didn't used graph.Flush(),and graph.Dispose() after finish using the graph object. thanks in advance Hussam

    C 1 Reply Last reply
    0
    • H Hussam Fattahi

      if we create an Graphics object named graph, use it to draw shap or any other thing. what would happen if i didn't used graph.Flush(),and graph.Dispose() after finish using the graph object. thanks in advance Hussam

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      I'm not sure about what Flush does in this context, but if it is like a file then it won't necessariliy complete the rendering until some later stage. Dispose is easier because it is a well defined interface. If you fail to call Dispose the garbage collector will dispose the object at some later stage. However, if an object has a Dispose method or implements IDisposable then you should be disposing it because it means the object had unmanaged or scarce resources which need to be freed up. Failing to free the resource in a timely manner may cause your application to perform poorly or crash (the resource be become exhausted and the garbage collector won't know anything about it)


      Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      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