Workaround for no methods in namespace in C#

I am new to C# and have a difficulty with the code structure. My application has:

(1) GUI with button Show my Ethernet IP. When user clicks this button PC’s IP address is displayed.

(2) Class ModbusTCPSlaveMachine. Within this class I create TCPListenter and supply it with PC’s Ethernet IP address.

In both cases I get local IP address using the same method GetAllLocalIPv4. Right now I have 2 copies of this method in the code (in classes Form and ModbusTCPSlaveMachine) which is not good I guess. For example, in Python I would simply place the method in some utility module. I am aware that methods cannot be located directly in the namespace in C# while don’t quite understand why.

The option I can think of is to place this function in a separate class – some utility class containing a single method (based on Python experience). Not sure if this is reasonable solution in C# beacuse this utility class looks like a meaningless container to me.

How can/should I solve the problem?