Will %= get a module of a collection? C# : This is what I have so far to get the modulus of the collection that is being passed into the Mod method.

    public static void Mod(int[] nums)
            {
                int total = 0;
                foreach (int num in nums)
                {
                    if (total == 0)
                    {
                        total = num;
                    }
                    else
                    {
                        total %= num;
                    }
                }
                Console.WriteLine("Mod: " + total);
            }

What I am wondering if this is the correct way to find this or will I get the totally wrong answer with this.