Click here to Skip to main content
15,892,199 members
Home / Discussions / C#
   

C#

 
QuestionHow do I call a C# DLL Using Visual Studio 2005 ( C# Code) Pin
Peter Usinga26-Dec-06 21:14
Peter Usinga26-Dec-06 21:14 
AnswerRe: How do I call a C# DLL Using Visual Studio 2005 ( C# Code) Pin
Colin Angus Mackay27-Dec-06 0:22
Colin Angus Mackay27-Dec-06 0:22 
AnswerRe: How do I call a C# DLL Using Visual Studio 2005 ( C# Code) Pin
ednrgc28-Dec-06 6:35
ednrgc28-Dec-06 6:35 
QuestionImages + Propertygrid Pin
Tanuja12326-Dec-06 19:51
Tanuja12326-Dec-06 19:51 
QuestionJPEG 2000 Pin
MozhdehQeraati26-Dec-06 19:39
MozhdehQeraati26-Dec-06 19:39 
Question???? Error in crystal Report Build by using Command SQL in c#.net ?? Pin
jaganil26-Dec-06 18:42
jaganil26-Dec-06 18:42 
GeneralRe: ???? Error in crystal Report Build by using Command SQL in c#.net ?? Pin
Tarakeshwar Reddy26-Dec-06 19:29
professionalTarakeshwar Reddy26-Dec-06 19:29 
QuestionSelection, as if it were text. [modified] Pin
Captain See Sharp26-Dec-06 15:58
Captain See Sharp26-Dec-06 15:58 
I am attempting to create a more efficient way to select data(like text). Before I used an index to the data that was stored in an array. I would have a separate collection or array that held the indexes of the data in another array. Each index in the "selection array" was selected. I think I have made a more efficient way to do that using two longs per selection, it does not matter how large the selection is, it will always be two longs.

void SelectData(long start, long end)
{
  _selected.Add(new Range(start, end));
  if (_selected.Count > 1)
    RemoveRangeRedundancies();
}

void RemoveRangeRedundancies()
{
  foreach (Range rr in _selected)
  {
    foreach (Range r in _selected)
    {
      if (rr == r) continue;

      if (rr.MinValue >= r.MinValue && rr.MaxValue <= r.MaxValue)  //selection completely inside an already selected range of data.
      {
        _selected.Remove(rr);
        continue;
      }

      if (rr.MinValue <= r.MinValue && rr.MaxValue >= r.MaxValue) //selection bigger on both or one rr.MaxValue
      {
        _selected.Remove(r);
        continue;
      }

      //selection bigger or connected to the left (join)
      if (rr.MinValue < r.MinValue && (rr.MaxValue >= r.MinValue - 1) && rr.MaxValue <= r.MaxValue)
      {
        Range newRange = new Range(rr.MinValue, r.MaxValue);
        _selected.Remove(rr);
        _selected.Remove(r);
        _selected.Add(newRange);
        continue;
      }

      //selection bigger or connected to the right (join)
      if (rr.MinValue >= r.MinValue && (rr.MinValue <= r.MaxValue + 1) && rr.MaxValue > r.MaxValue)
      {
        Range newRange = new Range(r.MinValue, rr.MaxValue);
        _selected.Remove(rr);
        _selected.Remove(r);
        _selected.Add(newRange);
        continue;
      }
    }
  }
}


Do you think that is a good design?

-- modified at 23:36 Tuesday 26th December, 2006


-- modified at 23:40 Tuesday 26th December, 2006


█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██

QuestionCollection.IndexOf Method Question? Pin
haz1326-Dec-06 13:46
haz1326-Dec-06 13:46 
AnswerRe: Collection.IndexOf Method Question? Pin
Christian Graus26-Dec-06 15:04
protectorChristian Graus26-Dec-06 15:04 
QuestionHow to copy and paste a file Pin
CodeItWell26-Dec-06 10:14
CodeItWell26-Dec-06 10:14 
AnswerRe: How to copy and paste a file Pin
Ravi Bhavnani26-Dec-06 10:34
professionalRavi Bhavnani26-Dec-06 10:34 
QuestionNCover and NUnit Pin
sroberts8226-Dec-06 9:40
sroberts8226-Dec-06 9:40 
AnswerRe: NCover and NUnit Pin
Net_Bond_2.017-May-09 22:23
Net_Bond_2.017-May-09 22:23 
QuestionMake Bigger CheckBox's Check Box Pin
Tyler4526-Dec-06 7:39
Tyler4526-Dec-06 7:39 
AnswerRe: Make Bigger CheckBox's Check Box Pin
Christian Graus26-Dec-06 15:05
protectorChristian Graus26-Dec-06 15:05 
GeneralRe: Make Bigger CheckBox's Check Box Pin
Tyler4526-Dec-06 19:00
Tyler4526-Dec-06 19:00 
QuestionSwitch Pin
Shevchenko726-Dec-06 6:35
Shevchenko726-Dec-06 6:35 
AnswerRe: Switch Pin
Luc Pattyn26-Dec-06 6:44
sitebuilderLuc Pattyn26-Dec-06 6:44 
GeneralRe: Switch Pin
Shevchenko726-Dec-06 7:00
Shevchenko726-Dec-06 7:00 
GeneralRe: Switch Pin
gnadeem26-Dec-06 7:08
gnadeem26-Dec-06 7:08 
AnswerRe: Switch Pin
Vega0227-Dec-06 7:00
Vega0227-Dec-06 7:00 
GeneralRe: Switch Pin
Shevchenko727-Dec-06 7:21
Shevchenko727-Dec-06 7:21 
QuestionHow to create a file Pin
CodeItWell26-Dec-06 6:29
CodeItWell26-Dec-06 6:29 
AnswerRe: How to create a file Pin
Luc Pattyn26-Dec-06 6:53
sitebuilderLuc Pattyn26-Dec-06 6:53 

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.