Skip to content

Import property without using typeof #522

@AndriiTomashevskyi

Description

@AndriiTomashevskyi

Hi, could you help, please? To add the following line to the target assembly:
this._startTime = DateTime.UtcNow;
I use the following code to import the UtcNow property:
var utcNowMethodInfo = typeof(DateTime).GetProperty(nameof(DateTime.UtcNow)).GetGetMethod();
var utcNow = moduleDefMD.Import(utcNowMethodInfo )
Is there a way to import utcNow without using typeof?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions