I found myself having to remove the first line of a string quite often while working on a text parser in C#. I put together a simple function to do that for me, but coming from a PHP background, I have no idea where to put it since I can't define a function outside a class. What's a customary way of doing that in .NET? Do I create a static class to store my function?
C# – Where should I put miscellaneous functions in a .NET project
- C# – Using global keyboard hook (WH_KEYBOARD_LL) in WPF / C#
- C# – What ‘additional configuration’ is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project
- .net – NUnit global initialization – bad idea
- .net – the difference between .NET Core and .NET Standard Class Library project types
I generally make a Helper or Utility static class and then put corresponding helper functions in there.
Additionally, I try to keep the Helper and Utility classes grouped logically - putting the text parsing functions alongside the object conversion functions is nonsensical. The confusion is cleared up with a TextUtils class and a ConversionUtils class.