Let the .NET program identifies its own running platform

xiaoxiao2021-04-05  267

.NET is written, the program running on the smart device sometimes needs to run on the PC, but some functions are different in NET and NETCF, or some other reasons, so that the program requires dynamic identification when running Is it running on Net FrameWord or a netcf of a smart device. In a project, this problem has been encountered, I originally wanted to identify the version number of NET, but did not find a suitable method. Therefore, it is temporarily used in this method, although it is not very good, but it is very effective (the principle is to run a Netcf does not support, and then do an exception decision)

Namespace minicafe.util {public class framework {///

/// determine if app is running on netcf /// public static bool isnetcf {get {bool flag = false; try {system.io. Directory.getcurrentDirectory (); Catch {Flag = true;}}}}}}}}

I think there should be more orthodox way to judge this problem, continue to explore ...

转载请注明原文地址:https://www.9cbs.com/read-132211.html

New Post(0)