Single segment length of a line
Algorithm

The time and space complexity of the current algorithm depends on the length of intervals in the input. This is very inefficient for inputs with long intervals, even when there are only few intervals.

The problem can be reworded as: merge the intervals and calculate their total length.
This should be fairly simple to implement efficiently:


Sort the intervals by start position ascending, and end position descending. That is, (5, 10) should come before (5, 8).
Initialize the previous interval = the first, and total = 0
Iterate from the second interval until the end, at each step:


If the current interval is fully included in previous, then skip it
If the current interval overlaps with previous, then update or replace previous to fully include both the previous and the current
If the current interval doesn't overlap with previous, then add the length of previous to total, and replace previous with the current

At the end, add the length of previous to total


Readability

There are serious readability concerns with this code.
This writing style is error-prone and confusing:


var slot=i+e.Desde-min;
if(slot&lt;cantidad)  
if(!bA.Get(slot))
{
   bA.Set(slot,true);
  recorrido++;
}
slot=e.Hasta-i-min-1;



The above should have been written like this:

var slot = i + e.Desde - min;
if (slot &lt; cantidad)
{
    if (!bA.Get(slot))
    {
        bA.Set(slot, true);
        recorrido++;
    }
}
slot = e.Hasta - i - min - 1;


This way the scope of the if statements is perfectly clear.

I also added spaces around operators and after commas as per the convention.

As a side note, in your algorithm the slot &lt; cantidad condition is always true, so in this example the first if statement had no effect,
as if it wasn't even there.