Search code examples
c#.netvisual-studiodecompiling

VS Errors beginner


I am new to the coding world and trying to learn. I am trying to understand how a .dll was written for what is it meant to do. I decompiled it and opened it as an assembly in VS. I learned a bit by looking at it's structure and I solved most of the errors that popped up when re-compiling it. But I am stuck at the very end. Here is the code:

public Request_NSBD FormRequest
{
    get =>this._request              
    private set
    {
        this._request = value;
    }     
}

I get errors CS1043, CS1513 and CS0161 in line 003 and errors CS1002 and CS1513 in line 004. Can anybody explain to me why I get this errors and how to fix them? I checked online for CSxxxx and can't understand what is wrong. If I follow VS's advice the errors become more and "worse". I strongly appreciate any insight you may give me on this.

I am a mechanic and my way to learn things is to open them and see what is inside. I figured out it would be the same for code, perhaps I was wrong.


Solution

  • It looks like you are trying to create a property to get/set a local variable _request of the type Request_NSBD. Try changing your code to this:

    public Request_NSBDFormRequest
    {
       get { return this._request; }
       set { this._request = value; }
    }
    

    As touched on by chris above, code written in certain styles take advantage of new language features, and may not compile with every version. Unless you are familiar with certain language syntax, it is best to use the more common implementation patterns.