diff --git a/Source/FloatHelper.cs b/Source/FloatHelper.cs
index 1321e0d..063ad00 100644
--- a/Source/FloatHelper.cs
+++ b/Source/FloatHelper.cs
@@ -185,7 +185,7 @@ namespace Nuclex.Support {
///
/// The memory contents of the floating point value interpreted as an integer
///
- public static int ReinterpretAsInt(float value) {
+ public static int ReinterpretAsInt(this float value) {
FloatIntUnion union = new FloatIntUnion();
union.Float = value;
return union.Int;
@@ -202,7 +202,7 @@ namespace Nuclex.Support {
/// The memory contents of the double precision floating point value
/// interpreted as an integer
///
- public static long ReinterpretAsLong(double value) {
+ public static long ReinterpretAsLong(this double value) {
DoubleLongUnion union = new DoubleLongUnion();
union.Double = value;
return union.Long;
@@ -215,7 +215,7 @@ namespace Nuclex.Support {
///
/// The memory contents of the integer value interpreted as a floating point value
///
- public static float ReinterpretAsFloat(int value) {
+ public static float ReinterpretAsFloat(this int value) {
FloatIntUnion union = new FloatIntUnion();
union.Int = value;
return union.Float;
@@ -230,7 +230,7 @@ namespace Nuclex.Support {
/// The memory contents of the integer interpreted as a double precision
/// floating point value
///
- public static double ReinterpretAsDouble(long value) {
+ public static double ReinterpretAsDouble(this long value) {
DoubleLongUnion union = new DoubleLongUnion();
union.Long = value;
return union.Double;
diff --git a/Source/IntegerHelper.cs b/Source/IntegerHelper.cs
index b84549d..1991106 100644
--- a/Source/IntegerHelper.cs
+++ b/Source/IntegerHelper.cs
@@ -29,14 +29,14 @@ namespace Nuclex.Support {
/// Returns the next highest power of 2 from the specified value
/// Value of which to return the next highest power of 2
/// The next highest power of 2 to the value
- public static long NextPowerOf2(long value) {
+ public static long NextPowerOf2(this long value) {
return (long)NextPowerOf2((ulong)value);
}
/// Returns the next highest power of 2 from the specified value
/// Value of which to return the next highest power of 2
/// The next highest power of 2 to the value
- public static ulong NextPowerOf2(ulong value) {
+ public static ulong NextPowerOf2(this ulong value) {
if(value == 0)
return 1;
@@ -55,14 +55,14 @@ namespace Nuclex.Support {
/// Returns the next highest power of 2 from the specified value
/// Value of which to return the next highest power of 2
/// The next highest power of 2 to the value
- public static int NextPowerOf2(int value) {
+ public static int NextPowerOf2(this int value) {
return (int)NextPowerOf2((uint)value);
}
/// Returns the next highest power of 2 from the specified value
/// Value of which to return the next highest power of 2
/// The next highest power of 2 to the value
- public static uint NextPowerOf2(uint value) {
+ public static uint NextPowerOf2(this uint value) {
if(value == 0)
return 1;
diff --git a/Source/StringBuilderHelper.cs b/Source/StringBuilderHelper.cs
index fe0a17f..8dace71 100644
--- a/Source/StringBuilderHelper.cs
+++ b/Source/StringBuilderHelper.cs
@@ -25,6 +25,12 @@ using System.Text;
namespace Nuclex.Support {
+/*
+ public enum Garbage {
+ Avoid,
+ Accept
+ }
+*/
/// Contains helper methods for the string builder class
public static class StringBuilderHelper {
@@ -35,7 +41,7 @@ namespace Nuclex.Support {
/// Clears the contents of a string builder
/// String builder that will be cleared
- public static void Clear(StringBuilder builder) {
+ public static void Clear(this StringBuilder builder) {
builder.Remove(0, builder.Length);
}
diff --git a/Source/StringHelper.cs b/Source/StringHelper.cs
index 596c6e3..ca62d3b 100644
--- a/Source/StringHelper.cs
+++ b/Source/StringHelper.cs
@@ -37,11 +37,7 @@ namespace Nuclex.Support {
/// array or -1 if all characters in the string were
/// present in the array.
///
-#if NO_EXTENSION_METHODS
- public static int IndexNotOfAny(string haystack, char[] anyNotOf) {
-#else
public static int IndexNotOfAny(this string haystack, char[] anyNotOf) {
-#endif
return IndexNotOfAny(haystack, anyNotOf, 0, haystack.Length);
}
@@ -59,11 +55,7 @@ namespace Nuclex.Support {
/// array or -1 if all characters in the string were
/// present in the array.
///
-#if NO_EXTENSION_METHODS
- public static int IndexNotOfAny(string haystack, char[] anyNotOf, int startIndex) {
-#else
public static int IndexNotOfAny(this string haystack, char[] anyNotOf, int startIndex) {
-#endif
return IndexNotOfAny(haystack, anyNotOf, startIndex, haystack.Length - startIndex);
}
@@ -83,11 +75,7 @@ namespace Nuclex.Support {
/// present in the array.
///
public static int IndexNotOfAny(
-#if NO_EXTENSION_METHODS
- string haystack, char[] anyNotOf, int startIndex, int count
-#else
this string haystack, char[] anyNotOf, int startIndex, int count
-#endif
) {
int anyLength = anyNotOf.Length;
@@ -117,11 +105,7 @@ namespace Nuclex.Support {
/// array or -1 if all characters in the string were
/// present in the array.
///
-#if NO_EXTENSION_METHODS
- public static int LastIndexNotOfAny(string haystack, char[] anyNotOf) {
-#else
public static int LastIndexNotOfAny(this string haystack, char[] anyNotOf) {
-#endif
return LastIndexNotOfAny(haystack, anyNotOf, haystack.Length - 1, haystack.Length);
}
@@ -139,11 +123,7 @@ namespace Nuclex.Support {
/// array or -1 if all characters in the string were
/// present in the array.
///
-#if NO_EXTENSION_METHODS
- public static int LastIndexNotOfAny(string haystack, char[] anyNotOf, int startIndex) {
-#else
public static int LastIndexNotOfAny(this string haystack, char[] anyNotOf, int startIndex) {
-#endif
return LastIndexNotOfAny(haystack, anyNotOf, startIndex, startIndex + 1);
}
@@ -163,11 +143,7 @@ namespace Nuclex.Support {
/// present in the array.
///
public static int LastIndexNotOfAny(
-#if NO_EXTENSION_METHODS
- string haystack, char[] anyNotOf, int startIndex, int count
-#else
this string haystack, char[] anyNotOf, int startIndex, int count
-#endif
) {
int anyLength = anyNotOf.Length;
diff --git a/Source/XmlHelper.cs b/Source/XmlHelper.cs
index 0825d79..a05f54d 100644
--- a/Source/XmlHelper.cs
+++ b/Source/XmlHelper.cs
@@ -145,47 +145,6 @@ namespace Nuclex.Support {
return false;
}
-#if USE_XMLDOCUMENT
-
- /// Loads an XML document from a file
- /// Schema to use for validating the XML document
- ///
- /// Path to the file containing the XML document that will be loaded
- ///
- /// The loaded XML document
- public static XmlDocument LoadDocument(XmlSchema schema, string documentPath) {
- using(FileStream documentStream = openFileForSharedReading(documentPath)) {
- return LoadDocument(schema, documentStream);
- }
- }
-
- /// Loads an XML document from a stream
- /// Schema to use for validating the XML document
- ///
- /// Stream from which the XML document will be read
- ///
- /// The loaded XML document
- public static XmlDocument LoadDocument(XmlSchema schema, Stream documentStream) {
- XmlReaderSettings settings = new XmlReaderSettings();
- settings.Schemas.Add(schema);
-
- using(XmlReader reader = XmlReader.Create(documentStream, settings)) {
- XmlDocument document = new XmlDocument();
- document.Schemas.Add(schema);
- document.Load(reader);
-
- ValidationEventProcessor eventProcessor = new ValidationEventProcessor();
- document.Validate(eventProcessor.OnValidationEvent);
- if(eventProcessor.OccurredException != null) {
- throw eventProcessor.OccurredException;
- }
-
- return document;
- }
- }
-
-#else // !USE_XMLDOCUMENT
-
/// Loads an XML document from a file
/// Schema to use for validating the XML document
///
@@ -228,8 +187,6 @@ namespace Nuclex.Support {
}
}
-#endif // USE_XMLDOCUMENT
-
/// Opens a file for shared reading
/// Path to the file that will be opened
/// The opened file's stream