Convert python script node to c# code node

I want to convert this Python code to C# code to create a custom node in Revit Dynamo. However, due to my limited knowledge, I have been unsuccessful. I have tried different AI tools but still failed to get the same result as the Python code. It would be great if I could get the .cs file code to meet my needs.Thankyou

python code:- `import sys

filePath = “C:\Users\KPOO5125\OneDrive Corp\OneDrive - AtkinsRéalis\Desktop\mmm.txt”

with open(filePath, “r”) as file:
mylines = [file.readline().strip(‘\n’)]

OUT = mylines
print(OUT)`

You’re trying to read a text file sitting on your C drive direct from Revit?
You want a node in Dynamo that will do this?
You want to do this using C# instead of python?

Why do you want it in C# when you have a working node already?

I just asked ChatGPT and it looks pretty simple…

What specific issues have you had?

Yes, it looks simple, but it is not running in my case. Not getting the output

Maybe post what you’ve done

1 Like

Post the c# code then if you need help

1 Like

My preferred method is to use a streamreader and the readline method. This is an example function I wrote in C#: