GetComponent help for C#. How to have object at edge of camera view

Hello I’m new to C#. The following code works in UnityScript with slight alterations. However, I can’t seem to get it to work in C#. I’ve tried an online converter, as well as searching Unity Answers for a fix, but I haven’t had much luck.

edge.transform.position = GetComponent< Camera > ()ViewportToWorldPoint(Vector3(1f, 0.5f, -zpos));

I already got a workaround by copying an example from the scripting reference, but I would like to know if it is possible to achieve this in one line in C# like it is in UnityScript. For anybody that comes across my question looking for an answer, here is the working code that you can use to achieve your goal

    Camera camera = GetComponent<Camera>();
    edge2.transform.position = camera.ViewportToWorldPoint(new Vector3(1f, 0.5f, -zpos));

P.S. So far C# seems to add a lot of “unnecessary” steps. I might just stick to UnityScript even if it doesn’t have any other function outside of Unity

Of course you can

    edge2.transform.position = GetComponent<Camera>().ViewportToWorldPoint(new Vector3(1f, 0.5f, -zpos));