1

Null可能なダブルを強制的にNaNとしてフレックスに渡す方法はフッ素にありますか? (およびその逆) デフォルトでは、これらの値は null として渡されますが、actionscript の Number は null 許容ではないため、デフォルトで 0 に変換されます。

サーバー側の null 許容 double をフレックスで NaN にする必要があり、flex からの NaN 値をサーバー側で null 許容 double にする必要があります。

何かご意見は?

どうも、

4

3 に答える 3

1

私はフッ素を知りませんが、あなたが渡すことができると思います:

  (myDouble ?? Double.NaN)

この式は 型doubleではなく型であり、だったdouble?場合myDoubleはNaN になりますnull

于 2010-08-19T14:54:36.027 に答える
0

同じ問題がありました。私たちの解決策は、オブジェクトを書き込むための Fluorine コードを変更することでした。

fileAMFWriterの line1367に、呼び出す直前WriteAMF3Data(memberValue)に次のコードを追加しました。

//Mapping null double?s to NaN when writing data.
if (memberValue == null)
{
    System.Reflection.PropertyInfo p = type.GetProperty(classMember.Name);
    if (p != null)
    {
        Type t = p.PropertyType; // t will be System.String
        if (t.IsEquivalentTo(typeof(Nullable<Double>)))
            memberValue = Double.NaN;
    }
}

これまでのところうまくいくようです。しかし、私は通常 .NET でコーディングしないので、これを行うためのより良い方法があるかもしれません。

于 2013-01-26T00:49:20.103 に答える
0

フッ素には、nullable の変換方法を定義する構成セクションがあるようです。まだテストしていません。

http://www.fluorinefx.com/docs/fluorine/nullable.htmlからコピー

FluorineFx.NET  
Null values
The <nullable> configuration section allows the use of special value of the given value type as the null value. 

Use this solution only when you can identify a value which is unused.

<nullable>
    <type name="System.Int32" assembly="MinValue"/>
    <type name="System.Double" assembly="MinValue"/>
    <type name="System.DateTime" assembly="MinValue"/>
    <type name="System.Guid" assembly="Empty"/>
</nullable>

The name attribute is the fully qualified type name, the value attribute is a static member of the type (such as "MinValue") or a parseable value (0 for System.Int32 for example).

The acceptNullValueTypes option
Fluorine will accept null values sent from client for value-types if configured accordingly

    <acceptNullValueTypes>false</acceptNullValueTypes>

If acceptNullValueTypes = true (the default is false if not specified) any value-type that is not explicitly initialized with a value will contain the default value for that object type (0 for numeric types, false for Boolean, DateTime.Min for DateTime)
于 2016-10-28T13:43:23.567 に答える