Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi am new here sorry if am posting wrong or similar.
I have some work in dnspy to merge assembly-csharp with .dll file and manage that but i need to internal go becauss avoiding BE to find it, and now i need just to load it in but its giving this.

{
Absolutly.Abso.Load();
}

But my console will not complire it and giving me error non-static field or method or property. Any idea how can i fix this?

Thank you for reading and you time :)

What I have tried:

Adding inside (NUM)
Removing ; or adding ;
Posted
Updated 17-Dec-19 22:29pm
v2

The error is pretty explicit:
An object reference is required for the non-static field abso.load()
What it means is that the class Abso declares a method called Load like this:
C#
public void Abso()
   {
   ...
   }
Which means that is it an instance method: it needs an instance of the Abso class to work.
Ignore computers for a moment, and think about cars:
What colour is your car? 
What colour is my car? 
What colour is this car? 
What colour is that car?
These are all valid questions because they specify the car that you are interested in - because all cars are not the same colour, you can;t ask:
What colour is a car?
And if you try, people will look at you rather strangely!
Conversely, you can ask
How many wheels has a car?
because all cars have four wheels - if they had two they would be a motorcycle!

"What colour?" is an instance question - it requires an instance of a car ("your car", "my car", "that car over there, beside the lamppost") before you can ask it. "How many wheels?" is a static question - you don't need to specify a vehicle to get an answer.

In C# we have the same things - an instance method requires a specific class instance because it can access instance related data, properties, and methods, and a static method does not (and can't access anything which is not explicitly declared as static either, without locating or creating an instance of the class).

So look at your Abso method and decide if it needs to access instance related data or not.
If it doesn't, then declare it as static :
C#
public static void Abso()
   {
   ...
   }

If it does, then call it via an instance:
C#
Absolutly.Abso abso = new Absolutly.Abso();
abso.Load();
 
Share this answer
 
Now i have problem, i try to implement esp and manage it now to work but it will not show esp box, is it becauss myb of this?

Absolutly.Abso abso = new Absolutly.Abso();
abso.Load();
 
Share this answer
 
Comments
Maciej Los 18-Dec-19 4:46am    
This is not an answer! Please, delete it to avoid down-voting. To post comment, use "Have a question or comment" widget under the solution.
conflicts with the imported type 'Abso' in 'Assembly-CSharp
 
Share this answer
 
Comments
Maciej Los 18-Dec-19 4:46am    
This is not an answer! Please, delete it to avoid down-voting. To post comment, use "Have a question or comment" widget under the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900