@@ -34,10 +34,11 @@ namespace ServiceStack.Text //Internalize to avoid conflicts
34
34
35
35
public static class MemoryStreamFactory
36
36
{
37
- public static RecyclableMemoryStreamManager RecyclableInstance = new RecyclableMemoryStreamManager ( ) ;
38
-
39
37
public static bool UseRecyclableMemoryStream { get ; set ; }
40
38
39
+ #if ! SL5
40
+ public static RecyclableMemoryStreamManager RecyclableInstance = new RecyclableMemoryStreamManager ( ) ;
41
+
41
42
public static MemoryStream CreateMemoryStream ( )
42
43
{
43
44
return UseRecyclableMemoryStream
@@ -58,8 +59,25 @@ public static MemoryStream CreateMemoryStream(byte[] bytes, int index, int count
58
59
? RecyclableInstance . GetStream ( typeof ( MemoryStreamFactory ) . Name , bytes , index , count )
59
60
: new MemoryStream ( bytes , index , count ) ;
60
61
}
62
+ #else
63
+ public static MemoryStream CreateMemoryStream ( )
64
+ {
65
+ return new MemoryStream ( ) ;
66
+ }
67
+
68
+ public static MemoryStream CreateMemoryStream ( byte [ ] bytes )
69
+ {
70
+ return new MemoryStream ( bytes ) ;
71
+ }
72
+
73
+ public static MemoryStream CreateMemoryStream ( byte [ ] bytes , int index , int count )
74
+ {
75
+ return new MemoryStream ( bytes , index , count ) ;
76
+ }
77
+ #endif
61
78
}
62
79
80
+ #if ! SL5
63
81
/// <summary>
64
82
/// Manages pools of RecyclableMemoryStream objects.
65
83
/// </summary>
@@ -1495,6 +1513,7 @@ private void ReleaseLargeBuffer()
1495
1513
#endregion
1496
1514
}
1497
1515
1516
+ //Avoid taking on an extra dep
1498
1517
public sealed partial class RecyclableMemoryStreamManager
1499
1518
{
1500
1519
//[EventSource(Name = "Microsoft-IO-RecyclableMemoryStream", Guid = "{B80CD4E4-890E-468D-9CBA-90EB7C82DFC7}")]
@@ -1618,5 +1637,5 @@ public void MemoryStreamOverCapacity(int requestedCapacity, long maxCapacity, st
1618
1637
}
1619
1638
}
1620
1639
}
1621
-
1640
+ #endif
1622
1641
}
0 commit comments