i like chatgpt
✅ Why does Console.WindowWidth produce Invalid Handle when the app is invoked from Process?
I have two console application projects:
HelloWorld
and Invoker
.
HelloWorld
It works fine when executed directly.
Invoker
It produces
Error: HelloWord's error: The handle is invalid.What is wrong?
3 replies
✅ Regex pattern to match unique words each with 3 unique characters
Given a multiline input text:
I am looking for a regex pattern that matches unique words each consists of exactly 3 unique characters.
The expected output:
Edit:
For new visitors, this question can actually be solved with
negative lookbehind
and negative lookahead
.
If you are in hurry, you can jump to https://discord.com/channels/143867839282020352/1204500978741673994/1204519081663926304
and return again to this message https://discord.com/channels/143867839282020352/1204500978741673994/1204500978741673994 in the future.
I may update with the solution. 🙂53 replies
Can these ternary expression with expensive method calls be simplified without outline variables ...
I do NOT want to
- call expensive methods more than once.
- make "outline" temporary variables. Outline variables are ones declared outside ternary expressions.
- leak variables with letters.
where
bool? ExpensiveMethod*<T,U>(T t, U u){}
.
Can these expression be simplified even further?10 replies
When do we need to use static test method?
Consider the following test class.
Results:
Thus both static and instance test methods are invoked.
From this results, I am wondering when we really need static test methods.
I am not 100% sure with my opinion. Please correct me if I am wrong.
Use static test methods to explicitly express our intent that the test methods don't want to use injected stuffs such as
ITestOutputHelper
because injected stuffs cannot be static.
The chained constraints that prevent static methods from participating in DI:
- Static methods can only access static members (other static methods, static fields, static properties, etc).
- Static constructor must be parameterless so it cannot be injected.
- Instance constructor cannot initialize static members.2 replies