Click here to Skip to main content
12,953,349 members (52,565 online)
Click here to Skip to main content

Tagged as


Posted 18 Jan 2013

Run method one time only

, 18 Jan 2013 CPOL
Here is one way to only run a method in code once. As you can see it uses a bool flag and a for loop to simulate multiple times being ran. After the first time the OnlyOnce method executes it sets the flag to true signifying its been ran and will not run within that for loop anymore.public...



Compare Revision Minor Date Status Editor
2 - publicly available No 18-Jan-13 12:50 Available David_Wimbley
Updates in content. 3 changes had been made.
1 No 18-Jan-13 12:50 Available David_Wimbley


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
United States United States
I'm a software developer and enjoy .net, angular, mvc, and many other different languages.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 18 Jan 2013
Article Copyright 2013 by David_Wimbley
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid