想不出来Encoder/Decoder中GetBytes/GetChars函数参数的最后一个那个bool flush是用来干嘛的,谁能写个当他=true和当他=false的对比例子让我看看吗?public virtual int GetChars (
byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex,
bool flush
)

解决方案 »

  1.   

    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/cpref23/html/M_System_Text_Decoder_GetChars_2_00cfdfac.htm
      

  2.   

    兄弟,这个东西我放在msdn里按了怎么没反应哦
    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/cpref23/html/M_System_Text_Decoder_GetChars_2_00cfdfac.htm
      

  3.   

    注意:此方法在 .NET Framework 2.0 版中是新增的。 在派生类中重写时,将指定字节数组的字节序列和内部缓冲区中的任何字节解码到指定的字符数组。一个参数,指示转换后是否要清除解码器的内部状态。 命名空间:System.Text
    程序集:mscorlib(在 mscorlib.dll 中)语法
    Visual Basic(声明) 
    Public Overridable Function GetChars ( _
    bytes As Byte(), _
    byteIndex As Integer, _
    byteCount As Integer, _
    chars As Char(), _
    charIndex As Integer, _
    flush As Boolean _
    ) As Integer
     
    Visual Basic(用法) 
    Dim instance As Decoder
    Dim bytes As Byte()
    Dim byteIndex As Integer
    Dim byteCount As Integer
    Dim chars As Char()
    Dim charIndex As Integer
    Dim flush As Boolean
    Dim returnValue As IntegerreturnValue = instance.GetChars(bytes, byteIndex, byteCount, chars, charIndex, flush)
     
    C# 
    public virtual int GetChars (
    byte[] bytes,
    int byteIndex,
    int byteCount,
    char[] chars,
    int charIndex,
    bool flush
    )
     
    C++ 
    public:
    virtual int GetChars (
    array<unsigned char>^ bytes, 
    int byteIndex, 
    int byteCount, 
    array<wchar_t>^ chars, 
    int charIndex, 
    bool flush
    )
     
    J# 
    public int GetChars (
    byte[] bytes, 
    int byteIndex, 
    int byteCount, 
    char[] chars, 
    int charIndex, 
    boolean flush
    )
     
    JScript 
    public function GetChars (
    bytes : byte[], 
    byteIndex : int, 
    byteCount : int, 
    chars : char[], 
    charIndex : int, 
    flush : boolean
    ) : int
     
    参数
    bytes
    包含要解码的字节序列的字节数组。 byteIndex
    第一个要解码的字节的索引。 byteCount
    要解码的字节数。 chars
    要用于包含所产生的字符集的字符数组。 charIndex
    开始写入所产生的字符集的索引位置。 flush
    如果要在转换后清除解码器的内部状态,则为 true;否则,为 false。 返回值
    写入 chars 参数的实际字符数。 
    备注
    若要计算 GetChars 存储结果字符所需的精确数组大小,请使用 GetCharCount。如果在将 flush 设置为 false 的情况下调用 GetChars,则位于数据块结尾的尾随字节将存储在内部缓冲区中,并在下一次解码操作中使用。对一个数据块调用 GetCharCount 后,紧接着对同一块调用 GetChars,以便在计算中包括前一个块的所有尾随字节。如果调用 GetChars,并将 flush 设置为 true,则忽略数据块末尾的无效字节并清除内部缓冲区。此方法影响解码器的状态。