Drawing 3D text in C#

I want to draw 3D text on certain positions in C#
I have this code snippet for LUA:

function DrawText3D(x,y,z, text, r,g,b) 
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    local dist = #(vector3(px,py,pz)-vector3(x,y,z))
 
    local scale = (1/dist)*2
    local fov = (1/GetGameplayCamFov())*100
    local scale = scale*fov
   
    if onScreen then
        if not useCustomScale then
            SetTextScale(0.0*scale, 0.55*scale)
        else 
            SetTextScale(0.0*scale, customScale)
        end
        SetTextFont(4)
        SetTextProportional(1)
        SetTextColour(r, g, b, 255)
        SetTextDropshadow(0, 0, 0, 0, 255)
        SetTextEdge(2, 0, 0, 0, 150)
        SetTextDropShadow()
        SetTextOutline()
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        DrawText(_x,_y)
    end
end

But I don’t know how to implenet it in C#
Any help would be appreciated!

If somebody stumbles up on this in the future, here is the code to do it.

        public Task Draw3dText(float x, float y, float z, string text, float size = 0.35f, int r = 255, int g = 255, int b = 255, int a = 215) {
            float _x = 0;
            float _y = 0;
            var onScreen = World3dToScreen2d(x, y, z, ref _x, ref _y);
            Vector3 pCoords = GetGameplayCamCoords();
            
            var distance = GetDistanceBetweenCoords(pCoords.X,pCoords.Y,pCoords.Z, x, y, z, true);
            var txtScale = (1 / distance) * 2;
            var fov = (1 / GetGameplayCamFov()) * 100;
            var scale = txtScale * fov * size;

            if (onScreen) {
                SetTextScale(0.0f, scale);
                SetTextFont(4);
                SetTextProportional(true);
                SetTextColour(r, g, b, a);
                SetTextDropShadow();
                SetTextEdge(0, 0, 0, 0, 150);
                SetTextDropShadow();
                SetTextOutline();
                SetTextEntry("STRING");
                SetTextCentre(true);
                AddTextComponentString(text);
                DrawText(_x,_y);
            }

            return Task.FromResult(0);
        }