在程序首次运行时执行一种方法 [英] perform a method just in program's first run

查看:101
本文介绍了在程序首次运行时执行一种方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想知道你们是否可以帮助我,如何在我的应用程序的第一次运行中做一个方法.
例如,我想在我的应用程序第一次执行时编写注册表项或创建文件或检查文件是否存在;

Hi 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.

推荐答案

我有整篇CodeProject文章专门致力于这个问题.请参阅:
希望您在这里……只有一次 [
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.

—SA


这篇关于在程序首次运行时执行一种方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆