Click here to Skip to main content
15,888,803 members
Home / Discussions / C#
   

C#

 
AnswerRe: Update Cache Data Pin
Manas Bhardwaj8-Sep-09 2:18
professionalManas Bhardwaj8-Sep-09 2:18 
GeneralRe: Update Cache Data Pin
sjs4u8-Sep-09 2:38
sjs4u8-Sep-09 2:38 
QuestionGet the automated changes from excel Pin
NarVish8-Sep-09 2:09
NarVish8-Sep-09 2:09 
QuestionSearch for repeated character combinations Pin
khalidelmeknesi8-Sep-09 2:07
khalidelmeknesi8-Sep-09 2:07 
AnswerRe: Search for repeated character combinations Pin
sanforjackass8-Sep-09 2:58
sanforjackass8-Sep-09 2:58 
GeneralRe: Search for repeated character combinations Pin
khalidelmeknesi8-Sep-09 3:08
khalidelmeknesi8-Sep-09 3:08 
AnswerRe: Search for repeated character combinations [modified] Pin
sanforjackass8-Sep-09 4:00
sanforjackass8-Sep-09 4:00 
GeneralRe: Search for repeated character combinations [modified] Pin
khalidelmeknesi16-Sep-09 22:48
khalidelmeknesi16-Sep-09 22:48 
I have found this example but it is not 100 % good. Could you please have a look?

using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
    class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            string _givenString = "wvtnfhxyz1hdxyz1fdxyz1ejxyz1dhxyz1dxyz1eeaa1oeys";<br />
            Dictionary<string, int> _codes = new Dictionary<string, int>();<br />
            int _startingPoint = 0;<br />
            while (_startingPoint < _givenString.Length)<br />
            {<br />
                for (int j = 2; j < _givenString.Length; j++)<br />
                {<br />
                    for (int i = _startingPoint; i < _givenString.Length && i + j < _givenString.Length; i++)<br />
                    {<br />
                        if (!_codes.ContainsKey(_givenString.Substring(i, j)))<br />
                        {<br />
                            _codes.Add(_givenString.Substring(i, j), 1);<br />
                        }<br />
                        else<br />
                        {<br />
                            _codes[_givenString.Substring(i, j)] += 1;<br />
                        }<br />
                    }<br />
                }<br />
                <br />
                _startingPoint++;<br />
            }<br />
<br />
            List<KeyValuePair<string, int>> _sortedCodes = SortDictionary(_codes);<br />
            for (int i = 0; i < 5; i++)<br />
            {<br />
                Console.WriteLine(_sortedCodes[i].Key + " : " + _sortedCodes[i].Value + " times");<br />
            }<br />
            Console.ReadKey();<br />
        }<br />
<br />
        public static List<KeyValuePair<string, int>> SortDictionary(Dictionary<string, int> data)<br />
        {<br />
            List<KeyValuePair<string, int>> result =<br />
                  new List<KeyValuePair<string, int>>(data);<br />
            result.Sort(<br />
              delegate(<br />
                KeyValuePair<string, int> first,<br />
                KeyValuePair<string, int> second)<br />
              {<br />
                  return second.Value.CompareTo(first.Value);<br />
              }<br />
              );<br />
            return result;<br />
        }<br />
    }<br />
}


modified on Thursday, September 17, 2009 8:13 AM

AnswerRe: Search for repeated character combinations Pin
sanforjackass18-Sep-09 12:05
sanforjackass18-Sep-09 12:05 
AnswerRe: Search for repeated character combinations Pin
Ian Shlasko8-Sep-09 5:41
Ian Shlasko8-Sep-09 5:41 
GeneralRe: Search for repeated character combinations Pin
khalidelmeknesi8-Sep-09 21:48
khalidelmeknesi8-Sep-09 21:48 
QuestionRedirect Console for In-Memory Execution Pin
Anindya Chatterjee8-Sep-09 1:49
Anindya Chatterjee8-Sep-09 1:49 
AnswerRe: Redirect Console for In-Memory Execution Pin
Not Active8-Sep-09 2:19
mentorNot Active8-Sep-09 2:19 
GeneralRe: Redirect Console for In-Memory Execution Pin
Anindya Chatterjee8-Sep-09 3:27
Anindya Chatterjee8-Sep-09 3:27 
GeneralRe: Redirect Console for In-Memory Execution Pin
Not Active8-Sep-09 3:36
mentorNot Active8-Sep-09 3:36 
GeneralRe: Redirect Console for In-Memory Execution Pin
Anindya Chatterjee8-Sep-09 3:43
Anindya Chatterjee8-Sep-09 3:43 
GeneralRe: Redirect Console for In-Memory Execution Pin
Not Active8-Sep-09 4:14
mentorNot Active8-Sep-09 4:14 
Questionhow to change individual gridline color in datagridview Pin
gtag8-Sep-09 1:48
gtag8-Sep-09 1:48 
QuestionXML tags for documentation: How to link to data type of parameter / function? Pin
Guido Carl8-Sep-09 1:24
Guido Carl8-Sep-09 1:24 
AnswerRe: XML tags for documentation: How to link to data type of parameter / function? Pin
N a v a n e e t h8-Sep-09 2:11
N a v a n e e t h8-Sep-09 2:11 
AnswerRe: XML tags for documentation: How to link to data type of parameter / function? Pin
Guido Carl8-Sep-09 2:19
Guido Carl8-Sep-09 2:19 
QuestionContext menu or Context menu with Icons Pin
rizwan.saddal8-Sep-09 1:02
rizwan.saddal8-Sep-09 1:02 
AnswerRe: Context menu or Context menu with Icons Pin
DaveyM698-Sep-09 1:11
professionalDaveyM698-Sep-09 1:11 
Questioniphone style scrolling Pin
benams8-Sep-09 0:47
benams8-Sep-09 0:47 
AnswerRe: iphone style scrolling Pin
Alan Balkany8-Sep-09 4:23
Alan Balkany8-Sep-09 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.