{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method 'toString(value)'
Method: toString(value)
Method Full Name:     Sys$Enum$toString(value)
Class: Enum
Namespace: Sys
Source File: MicrosoftAjax.debug.js
1   function Sys$Enum$toString(value) {
2     /// <summary locid="M:J#Sys.Enum.toString" />
3     /// <param name="value" optional="true" mayBeNull="true"></param>
4     /// <returns type="String"></returns>
5     var e = Function._validateParams(arguments, [
6     {name: "value", mayBeNull: true, optional: true}
7     ]);
8     if (e) throw e;
9     if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
10    if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this);
11    var values = this.prototype;
12    var i;
13    if (!this.__flags || (value === 0)) {
14      for (i in values) {
15        if (values[i] === value) {
16          return i;
17        }
18      }
19    }
20    else {
21      var sorted = this.__sortedValues;
22      if (!sorted) {
23        sorted = [];
24        for (i in values) {
25          sorted[sorted.length] = {key: i, value: values[i]};
26        }
27        sorted.sort(function(a, b) {
28          return a.value - b.value;
29          });
30        this.__sortedValues = sorted;
31      }
32      var parts = [];
33      var v = value;
34      for (i = sorted.length - 1; i >= 0; i--) {
35        var kvp = sorted[i];
36        var vali = kvp.value;
37        if (vali === 0) continue;
38        if ((vali & value) === vali) {
39          parts[parts.length] = kvp.key;
40          v -= vali;
41          if (v === 0) break;
42        }
43      }
44      if (parts.length && v === 0) return parts.reverse().join(', ');
45    }
46    throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
47  }
This is the JavaScript source for method toString(value) from ASP.NET AJAX Library. Full name for this method is Sys$Enum$toString(value). It belongs to the class Enum, which is in Sys namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map