« first day (3388 days earlier)      last day (1543 days later) » 

5:52 AM
I thought I understood the difference between .Net Standard/.Net Core and the good 'ol .Net Framework...but I've run into an issue I can't explain.

I'm looking at a .NETStandard v2.1 Class Library .dll file. It uses ColorTranslator.FromHtml() from System.Drawing. The problem is that when I look at the Microsoft docs (https://docs.microsoft.com/en-us/dotnet/api/system.drawing.colortranslator?view=netframework-4.8&viewFallbackFrom=netstandard-2.1) it says it doesn't exist for netstandard-2.1

I'm using Rider and if I have a project that uses ColorTranslator that targets netstandard-2.1 the
 
 
1 hour later…
V.7
7:10 AM
o/
 
mr5
7:35 AM
@RobP. You're either using netcore or netframework but not netstandard. As I understand it, netstandard is like an interface while netcore and netframework are the class or the implementations of that interface
 
I thought that wasn't true of Class Libraries - but I fully admit, I'm probably misunderstanding everything
 
mr5
7:53 AM
@RobP. that just means the class library is available for all the implementations that adhere to netstandard 2.1
 
 
1 hour later…
9:19 AM
Right - but I can't build the class library when it's targeting netstandard 2.1 - I get errors on code that uses ColorTranslator.FromHtml

I think that makes sense because the documentation says ColorTranslator isn't part of the netstandard 2.1

But if I target netstandard2.1 and net462 - then I can build and in my bin/debug/netstandard2.1 folder I have a .dll that contains those calls to ColorTranslator
I didn't think you could have a .dll that targets netstandard 2.1 and uses something like ColorTranslator?
 
 
1 hour later…
10:26 AM
Hi,
I need to get logged in user name from the service in Windows using c#
I have used this:
59
Q: How do I get the currently-logged username from a Windows service in .NET?

Rajkishor SahuI have a Windows service which need the currently logged username. I tried System.Environment.UserName, Windows identity and Windows form authentication, but all are returning "System" as the user as my service is running in system privileged. Is there a way to get the currently logged in usernam...

ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT UserName FROM Win32_ComputerSystem");
ManagementObjectCollection collection = searcher.Get();
string username = (string)collection.Cast<ManagementBaseObject>().First()["UserName"];
Yeah
but it is working only when I have logged in as administrator
and not working for standatrd user
 
 
9 hours later…
7:05 PM
Does 3+"hi" have a syntax error or static semantic error?
 

« first day (3388 days earlier)      last day (1543 days later) »