This is my Program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Myclass
    {
        static void Main(string[] args)
        {
            Myclass d = new Myclass();
            d.Myprog("ahasda");
        }
        void Myprog(params string[] s)
        {          
            int num=0;
            foreach (string r in s)
            {
                if (r.Contains('a'))
                {
                    num++;
                }     
            }
            Console.WriteLine(num);   
        }
    }
}

I want to know a few characters in my strings while I code shows only one.
What to correctly display the desired number of characters do?

static void Main(string[] args)
        {
            Program d = new Program();
            d.Myprog("ahasda");
            Console.ReadLine();
        }
        void Myprog(params string[] array)
        {
            int num = 0;

            foreach (string str in array)
            {
                foreach (char c in str)
                {
                    if (c.Equals('a'))
                        num++;
                }
            }
            Console.WriteLine(num);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.