system.reflection

How to get class library assembly reference in .NET Core project?

三世轮回 提交于 2021-02-09 07:01:41
问题 I have an ASP.NET Core project (netcoreapp2.0) that references models in a class library project (netstandard2.0). I'm trying to use Mapster to map objects stored in the class library. The documentation for Mapster says to call the Scan method from Startup.cs using the code: TypeAdapterConfig.GlobalSettings.Scan(assembly1, assembly2, assemblyN) Where I'm having issues is how to best get the assembly reference for the class library to pass to the Scan method. I think this is more of a general

How can I programmatically do method overload resolution in C#?

耗尽温柔 提交于 2021-02-07 04:49:20
问题 When the C# compiler interprets a method invocation it must use (static) argument types to determine which overload is actually being invoked. I want to be able to do this programmatically. If I have the name of a method (a string ), the type that declares it (an instance of System.Type ), and a list of argument types I want to be able to call a standard library function and get back a MethodInfo object representing the method the C# compiler would choose to invoke. For instance if I have

Get all properties of a class recursively C#

混江龙づ霸主 提交于 2021-01-29 07:57:19
问题 I have a class which looks like public class Employee { public string FirstName { get; set; }; public string LastName { get; set; }; public Address Address { get; set; }; } public class Address { public string HouseNo { get; set; }; public string StreetNo { get; set; }; public SomeClass someclass { get; set; }; } public class SomeClass { public string A{ get; set; }; public string B{ get; set; }; } I have figured out a way finding out Properties in a class which are primitive like the string,

Dependant DLL loading issue in MQL5 from C#

微笑、不失礼 提交于 2020-12-15 05:18:04
问题 I have this code for MQL5. #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #import "Indicator\\..\\Libraries\\PythonConnect.dll" int OnInit() { //--- return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- Print(PythonConnect1:

Winforms: getting Publish Version number?

百般思念 提交于 2020-12-02 12:47:15
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This

Winforms: getting Publish Version number?

痴心易碎 提交于 2020-12-02 12:45:48
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This

Winforms: getting Publish Version number?

流过昼夜 提交于 2020-12-02 12:45:38
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This

Winforms: getting Publish Version number?

試著忘記壹切 提交于 2020-12-02 12:43:58
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This

Winforms: getting Publish Version number?

会有一股神秘感。 提交于 2020-12-02 12:39:08
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This

Winforms: getting Publish Version number?

别等时光非礼了梦想. 提交于 2020-12-02 12:38:17
问题 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 Property Pages of the app, Publish tab)? When I use Reflection.Assembly.GetExecutingAssembly().GetName().Version etc it seems to use the AssemblyVersion number from AssemblyInfo.vb, which isn't the same. If I use wildcards in the AssemblyInfo.vb it comes out different numbers again. 回答1: This