Click here to Skip to main content
13,043,092 members (51,903 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I wonder if you guys can help me, how can I do a method just in my application's first run.
for e.g I want to write a registry key or create a file or checking existence of a file at the first time my application is executed; and other times it is executed the method will be ignored.
Posted 15-Aug-12 15:34pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have a whole CodeProject article devoted exactly to this problem. Please see:
Wish You Were Here… Only Once[^].

Please see: this is pretty interesting. Even though my main very sophisticated method is very unusual and is developed mostly for fun, it is fully functional, based on the CLI standards, effective and demonstrates using very non-trivial technique. Besides, regular, non-esoteric approach to the problem is fully explained and discussed.

Mostafa M.A 15-Aug-12 22:18pm
it's exactly what I want, but as you said before my knowledge is not enough to understand whole code.
actually I didn't understand most of it's parts.
hope that I'll understand all of it soon.
you know, I don't have such a lot of free time to go on C# programming, because this is not my main field in university. I study Civil Engineering...
so it might take such a long time for me to get familiar and to be expert in C#.
I really thank you for your kind answers to my problems
Sergey Alexandrovich Kryukov 15-Aug-12 22:25pm
You don't have to understand the code -- it is well tested (you can easily test it with your code) and documented, you can just build my assembly, reference it and use in your projects as shown in the usage samples. The implementation is really tricky; as a matter of fact, I did not expect you to understand it; nevertheless, it is quite reliable, because only the conception and ideas are hard to understand, the implementation itself is very short and simple. If you keep interest to this matter and want to understand some detail later, I'll gladly answer your question.

Besides, look at the very beginning of the article to see what people would "usually" do.

So, anyway, please accepting the answer formally (green button) -- thanks. It is kind of quite comprehensive.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 15 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100