
1157
DEVELOPING
COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Las
t
upda
te
d 8/5/2010
Converting between .NET and ColdFusion data types
Accessing .NET classes requires a Java proxy on the ColdFusion system and .NET code on the target system, so data
must be converted among ColdFusion, Java, and .NET (to be exact, Microsoft Intermediate Language, or MSIL) data
types. ColdFusion converts data types automatically. Usually, you do not have to take any special steps to ensure
correct conversion. Some conversion limitations exist, and in some cases you must explicitly specify a data type when
you call a method in a .NET proxy object.
The following paragraphs describe data conversion issues and how to handle them. For a detailed specification of how
ColdFusion converts among ColdFusion data, Java data types, and .NET data types, see cfobject: .NET object in the
CFML Reference
.
Data type conversion rules and techniques
ColdFusion converts data automatically among ColdFusion, Java, and CLR data types. The following table indicates
how ColdFusion converts among .NET Common Language Runtime (CLR) primitive and standard data types, the
Java data types used in the proxies to represent CLR data types, and ColdFusion data types in your CFML application.
.NET type
Java type
ColdFusion type
sbyte
byte
Integer
byte
short
Integer
short
short
Integer
ushort
int
Integer
int
int
Integer
uint
long
Number
char
char
Integer or string
long
long
Number
ulong
float
Number
float
float
Number
double
double
Number
The returned number retains greater precision than is normally displayed in ColdFusion.
Use the PrecisionEvaluate function to access and display the full precision of a returned
double value. You can also pass a value with full double precision to a .NET method.
bool
boolean
Boolean
enum
Not converted, but enumerator elements can be accessed directly by using the format
Enumerator_variable.enumerator, as in MyColor.Red
array
array
Array
string
String
String
System.Collections.ArrayLis
t
java.util.ArrayList
Array
Note:
ColdFusion converts from .NET type to ColdFusion type only, it does not convert
ColdFusion Arrays to .NET ArrayLists.
System.Collections.Hashtab
le
java.util.Hashtable
Structure
Note:
ColdFusion converts from .NET type to ColdFusion type only, it does not convert
ColdFusion Structures to .NET Hashtables
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...