Skip to content
Rain Hu's Workspace
Go back

[C#] static class 靜態類別

Rain Hu

1. 介紹

public static class Util
{
    public static string getCOL(string str, char del, int col)
    {
        string[] arr = str.Split('_');
        int n = arr.Length;
        try 
        {
            return arr[col-1];
        }
        catch
        {
            string text = $"Index out of bound.\nIndex should be between 1 and {n}";
            throw new Exception(text);
        }
    }
}

Share this post on:

Previous
[C#] Property getter/setter access separate 訪問權限分離
Next
[C#] C# 筆記