system.reflection Questions

4

Solved

In my small project I'm using System.Reflection classes to produce executable code. I need to call the + operator of a custom type. Does anybody know how can I call customized operator of custom cl...

3

Solved

What is the best way to convert a string into a Type object in .NET? Issues to consider: The type may be in a different assembly. The type's assembly may not be loaded yet. This is my attempt,...
Liner asked 3/3, 2009 at 21:39

2

Solved

How to iterate through DbContext and decrypt certain fields I am using this StackOverflow answer as a guide: Database Table Export to CSV using EntityFramework DbContext .NET 6 We have very a legac...
Ustulation asked 5/10, 2023 at 23:18

2

Solved

In my application I receive the functionCode value from somewhere and need to reflect the appropriate class. I tried to reflect the appropriate type According to this solution. but it doesn't work ...
Tocantins asked 5/2, 2015 at 10:59

4

I've a method that generates list of class type from data of data reader. if (datareader != null && datareader .HasRows) { Dictionary<string, PropertyInfo> pDict= GetPropertyDictiona...
Nikaniki asked 13/6, 2018 at 16:38

6

I maintain far too many NuGet packages and I'm trying to find a tool that generates a plain text file of the public API surface for each assembly (like a post-build step). Each namespace, class, in...
Giglio asked 6/8, 2022 at 3:42

3

Solved

We have a little task to print in a console window all the variables of the Environment class using reflection, but how to do so I don't even have a clue. I am sorry if I've written anything wrong ...

5

I have a console application (MyProgram.EXE) that references a Utilities assembly. In my Utilities assembly, I have code that does: Dim asm As Assembly = Assembly.GetExecutingAssembly() Dim locat...
Morelli asked 22/1, 2009 at 17:16

3

Solved

I want to inspect assemblies if they have a specific type without loading the assembly in the current scope, which is available via MetadataLoadContext in .NET Core 3. But if I try the following e...
Sempstress asked 12/2, 2020 at 15:19

4

Solved

How to convert PropertyInfo to property expression which can be used to invoke StructuralTypeConfiguration<TStructuralType>.Ignore<TProperty>(Expression<Func<TStructuralType, TPro...
Cytolysin asked 8/3, 2012 at 17:6

4

Solved

I try to map my Id fields with the Column Attributes but for some reason this doesn't seem to work and I can't figure out why. I set up a test project to demonstrate what I am trying. First, I got...
Newt asked 6/1, 2014 at 13:56

1

In our CI, we sometimes get the following error: System.IO.FileNotFoundException : Could not load file or assembly '<our-assembly-name>.resources, Version=1.0.0.0, Culture=en-US, PublicKeyTok...
Halation asked 25/10, 2021 at 11:34

3

I'm trying to use System.Reflections to get a DbSet<T> dynamically from its name. What I've got right now is: The DbSet name The DbSet's Type stored on a variable The issue I'm facing co...
Russia asked 9/10, 2018 at 12:59

2

Solved

Is there a function or by using reflection a way to get all the System types. Like those: - System.Int64 System.Byte[] System.Boolean System.String System.Decimal System.Double ... We have an ...
Ungula asked 9/4, 2015 at 17:42

5

I am using a xml file as an embedded resource to load an XDocument. We are using the following code to get the appropriate file from the Assembly: XDocument xd = new XDocument(); Assembly assembly...
Phifer asked 4/3, 2010 at 0:25

8

Solved

How can I get my property? Currently an error is occuring of Ambiguous match found, see the comment line in code. public class MyBaseEntity { public MyBaseEntity MyEntity { get; set; } } public ...
Dead asked 12/7, 2012 at 0:59

8

Solved

I am implementing some kind of deserialization and struggled with a next problem: I have List<object> and System.Reflection.Field, it's FieldType can be List<string>, List<int> o...
Maurizia asked 8/4, 2014 at 14:7

3

Solved

I have a private static generic method I want to call using reflection, but really I want to 'bundle' it inside of another method. C# 7.0 supports local functions so this is definitely possible. Y...
Centuple asked 11/4, 2017 at 13:59

5

Solved

I've got a Winforms app and want to display the version number so that we can know if our update scripts are running correctly. Is there a way to get the Publish Version number (as displayed in the...
Sibel asked 7/5, 2013 at 16:9

2

Solved

I'm working on creating a generic repository for an EF Core project to avoid having to write CRUD for all models. A major roadblock I've hit is navigation properties not being loaded since Core doe...
Zeuxis asked 21/6, 2017 at 17:26

1

Solved

In C# overriding auto-property and providing only one accessor makes reflection via PropertyInfo "lose" the other one, even though it is defined in base class. It can look strange at a first glanc...
Broadnax asked 3/9, 2019 at 16:56

2

Solved

When trying to get properties accessors from derived properties or use CanRead / CanWrite, for some reason base auto-properties are not taken into account. CanRead and CanWrite return values based...
Parboil asked 2/9, 2019 at 20:21

4

I want to write unit test for below class. If name is other than "MyEntity" then mgr should be blank. Negative Unit test Using Manager private accessor I want to change name to "Test" so that mgr ...
Apperception asked 17/7, 2012 at 10:42

3

Solved

I have developed a Library for internal email reporting. When I am using that Library from another project (By Adding Reference). It gives NullReferenceException on the following line. System.Re...
Cockleshell asked 25/2, 2011 at 12:14

4

Solved

I don't know whether this is possible or not, but I would like to know if it is and, if so, how it works. So here is my question: I have 2-3 custom model classes of my own. For example, Customer, E...
Lungan asked 16/3, 2013 at 13:23

© 2022 - 2024 — McMap. All rights reserved.