========= Utilities ========= .. index:: FogCreek.Core.Arrays .. _FogCreek.Core.Arrays: FogCreek.Core.Arrays ==================== Class that provides static utility methods for manipulating arrays in Wasabi. Since Wasabi lacks support for generics, these methods are implmented as code generators that produce type specific methods. .. index:: pair: FogCreek.Core.Arrays; Append Append ------ Concatenates two arrays together producing a new array:: Dim zs = Arrays.AppendInt32(xs, ys) .. index:: pair: FogCreek.Core.Arrays; ArrayFromICollection ArrayFromICollection -------------------- Coverts an `ICollection `_ into a strongly typed array. Useful for allowing you to build up a list of objects using a .NET collection and then turn it into an array after you're done with it:: Dim result = Arrays.ArrayFromICollectionInt32(list) .. index:: pair: FogCreek.Core.Arrays; Filter Filter ------ Produces a new array containing only the values that match the supplied predicate:: Dim ys = Arrays.FilterInt32(xs, Lambda (x) x > 0) .. index:: pair: FogCreek.Core.Arrays; Map Map --- Produces a new array containing the result of passing eacy element through a transformation function:: Dim ys = Arrays.MapInt32ToInt32(xs, Lambda (x) x + 1) .. index:: FogCreek.Core.Html .. _FogCreek.Core.Html: FogCreek.Core.Html ================== .. index:: pair: FogCreedk.Core.Html; Encode Encode ------ HTML encodes the string that's passed in making it safe fore inclusion as a text node in an HTML document::

<%= Html.Encode(comment.body) %>

.. index:: pair: FogCreedk.Core.Html; AttributeEncode AttributeEncode --------------- .. warning:: Html.AttributeEncode() does not encode ``'``, or ``>`` this means two things: 1. Attributes in HTML must be quoted using double quotes (``"``), otherwise an encoded string could prematurely terminate the attribute resulting in an XSS vulnerability. 2. Html.AttributeEncode() should not be used outside of HTML attributes, because doing so can allow illegal characters through (``>``) which can result in an invalid HTML document (though probably not an XSS vulnerability). Replaces ``"``, ``<``, and ``&`` with their repective HTML entities making an arbitrary string suitable for use inside an HTML attribute::

...