Click here to Skip to main content
15,884,388 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to generate random decimal numbers in C# Pin
jsc4219-Aug-20 6:41
professionaljsc4219-Aug-20 6:41 
QuestionReading Multiple files Pin
lalgourav11-Aug-20 5:45
lalgourav11-Aug-20 5:45 
AnswerRe: Reading Multiple files Pin
Gerry Schmitz11-Aug-20 6:25
mveGerry Schmitz11-Aug-20 6:25 
AnswerRe: Reading Multiple files Pin
OriginalGriff11-Aug-20 6:29
mveOriginalGriff11-Aug-20 6:29 
AnswerRe: Reading Multiple files Pin
Eddy Vluggen13-Aug-20 12:20
professionalEddy Vluggen13-Aug-20 12:20 
QuestionGet if Device is enabled or Disabled in C# Pin
XxKeldecknightxX10-Aug-20 5:52
XxKeldecknightxX10-Aug-20 5:52 
AnswerRe: Get if Device is enabled or Disabled in C# Pin
Luc Pattyn10-Aug-20 10:44
sitebuilderLuc Pattyn10-Aug-20 10:44 
GeneralRe: Get if Device is enabled or Disabled in C# Pin
Luc Pattyn10-Aug-20 12:02
sitebuilderLuc Pattyn10-Aug-20 12:02 
Here is fresh code that works for me:

using System;
using System.Management;

namespace LP_Core {
	public class LP_Ethernet {
		public static string GetState() {
			string query = "SELECT NetConnectionStatus FROM Win32_NetworkAdapter "+
				"WHERE NetConnectionID='Ethernet'";
			ManagementObjectSearcher ethernets = new ManagementObjectSearcher(query);
			foreach (ManagementObject ethernet in ethernets.Get()) {
				switch (Convert.ToInt32(ethernet["NetConnectionStatus"])) {
				// constants: https://docs.microsoft.com/en-us/dotnet/
				// api/microsoft.powershell.commands.netconnectionstatus
				case 0:
					return "disabled";
				case 7:
					return "enabled but disconnected";
				case 2:
					return "enabled and connected";
				default:
					return "unknown";
				}
			}
			return "absent";
		}
	}
}


Smile | :)
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...


modified 10-Aug-20 21:38pm.

AnswerRe: Get if Device is enabled or Disabled in C# Pin
Eddy Vluggen10-Aug-20 11:57
professionalEddy Vluggen10-Aug-20 11:57 
QuestionThe provider is not compatible with the version of Oracle client Pin
Member 148339589-Aug-20 22:57
Member 148339589-Aug-20 22:57 
AnswerRe: The provider is not compatible with the version of Oracle client Pin
OriginalGriff9-Aug-20 23:07
mveOriginalGriff9-Aug-20 23:07 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
Member 1483395810-Aug-20 1:13
Member 1483395810-Aug-20 1:13 
SuggestionRe: The provider is not compatible with the version of Oracle client Pin
Richard Deeming10-Aug-20 1:46
mveRichard Deeming10-Aug-20 1:46 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
Member 1483395810-Aug-20 2:03
Member 1483395810-Aug-20 2:03 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
Richard MacCutchan10-Aug-20 3:26
mveRichard MacCutchan10-Aug-20 3:26 
AnswerRe: The provider is not compatible with the version of Oracle client Pin
Eddy Vluggen10-Aug-20 12:04
professionalEddy Vluggen10-Aug-20 12:04 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
OriginalGriff10-Aug-20 19:36
mveOriginalGriff10-Aug-20 19:36 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
Richard Deeming10-Aug-20 21:47
mveRichard Deeming10-Aug-20 21:47 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
OriginalGriff10-Aug-20 21:54
mveOriginalGriff10-Aug-20 21:54 
GeneralRe: The provider is not compatible with the version of Oracle client Pin
Jörgen Andersson12-Aug-20 9:17
professionalJörgen Andersson12-Aug-20 9:17 
QuestionNeed to add a new visual studio solution to an existing visual studio solution Git repository Pin
syedripon6-Aug-20 6:43
syedripon6-Aug-20 6:43 
AnswerRe: Need to add a new visual studio solution to an existing visual studio solution Git repository Pin
Dave Kreskowiak6-Aug-20 7:05
mveDave Kreskowiak6-Aug-20 7:05 
AnswerRe: Need to add a new visual studio solution to an existing visual studio solution Git repository Pin
OriginalGriff6-Aug-20 7:58
mveOriginalGriff6-Aug-20 7:58 
QuestionI need to see if a digit from a number is odd or even in c# Pin
keeponfalling125-Aug-20 4:24
keeponfalling125-Aug-20 4:24 
AnswerRe: I need to see if a digit from a number is odd or even in c# Pin
OriginalGriff5-Aug-20 4:58
mveOriginalGriff5-Aug-20 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.