Skip to main content
2 votes
0 answers
97 views

I recently discovered MethodRental and it seems really interesting, coming from JS, being able to pre-empt existing functions can be a neat hacky get-out-of-jail card for the toolbelt. As an aside, ...
Hashbrown's user avatar
  • 13.2k
0 votes
1 answer
89 views

I am extending my C# J2K library to dynamically register codecs from other assemblies. That part is working, but I am having trouble understanding IsAssignableFrom(TypeInfo) and how I can deduce which ...
Cinder Biscuits's user avatar
0 votes
2 answers
73 views

I'm currently working on a console application that essentially mimics an ASP.NET Web API. Everything was going smoothly until I ran into an issue regarding route attributes. What I'm trying to ...
Mateusz's user avatar
0 votes
1 answer
100 views

I use .NET 9 and blazor, ASP.NET Core Identity - role, policy, claim. To differentiate access on pages and components, the code is using policies - like this: @attribute [Authorize(Policy("...
kocapb's user avatar
  • 1
-1 votes
1 answer
70 views

I got tired of dealing with properties and fields separately so I made a VariableInfo strategy pattern to handle both without having to know what type it is. You feed the context a FieldInfo or a ...
A person's user avatar
2 votes
1 answer
266 views

The short of it is that I got tired of dealing with properties and fields separately. I made a VariableInfo strategy pattern to handle both without having to know what type it is. You feed the context ...
A person's user avatar
2 votes
0 answers
47 views

Is there a way to use reflection to programmatically inspect and determine if a given compiled cmdlet requires elevation? Notes: This question concerns compiled cmdlets, not script (text) files. ...
Paul π's user avatar
  • 585
0 votes
1 answer
86 views

PROBLEM TO SOLVE I'm trying to create a mock of interface ISomeService using Moq library which will wrap its real implementation SomeService. Right now I'm doing this manually like this: var instance =...
Arthur's user avatar
  • 201
3 votes
1 answer
127 views

I need some way of constructing a function pointer type that points to a specific function signature. So something like this: Type[] args = [typeof(int), typeof(int)]; // Pointer to (int -> int) ...
Jonas _'s user avatar
  • 172
-1 votes
2 answers
135 views

My class looks something like this: public class Test { public A[] ArrayA { get;set; } } public class A { public string P1 { get;set; } public int P2 { get;set; } } Suppose I have two ...
Shao Skywalker's user avatar
2 votes
2 answers
186 views

using System; using System.Runtime.InteropServices; using System.Reflection; public struct StructCreatedByUser { public int x; public float anything; public string name; } class Program { ...
Bilal's user avatar
  • 31
1 vote
1 answer
123 views

Preamble: I was looking at how best to implement a general-purpose decorator in C# that copes with async methods. Most examples use DispatcherProxy, which only offers a synchronous Invoke. Unless NET ...
naviwhack's user avatar
  • 127
2 votes
2 answers
139 views

I need to invoke a given DynamicObject with a given array of arguments. However, I am struggling on how exactly to do this. What I would like to do: using System.Dynamic; using System.Reflection; ...
user avatar
0 votes
2 answers
73 views

Given the following sample POCO class: public class TestClass { public int Id { get; init; } public TestClass() {} } How can I initialize the Id property using Reflection? The result should ...
AxD's user avatar
  • 3,324
-2 votes
2 answers
142 views

I want to activate, via reflection automatically and recursively all the nested classes inside a class I am instantiating. Here is the template of what I am trying to do, but I do not know how to make ...
Jada's user avatar
  • 25

15 30 50 per page
1
2 3 4 5
77