How to distinguish design time from run-time?

I am using the code below, but I want to know is there a better way to check if I am in design time?
if( System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv" )
			{
				return;
			}

Open in new window

HOVEAsked:
Who is Participating?
 
aherpsConnect With a Mentor Commented:
From:http://vidmar.net/weblog/archive/2005/04/11/1246.aspx

1.) Call GetService(typeof(IDesignerHost)) and see if it returns something.

2.) System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Nevermind...I misread the question.   =\
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.