public GetEncoder ( ) : System.Text.Encoder | ||
Résultat | System.Text.Encoder |
static public int GetEncoder(IntPtr l) { try { System.Text.UnicodeEncoding self = (System.Text.UnicodeEncoding)checkSelf(l); var ret = self.GetEncoder(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
public void PosTest1() { Char[] Chars = GetCharArray(10); Byte[] bytes = new Byte[20]; Byte[] desBytes = new Byte[20]; int buffer; int outChars; bool completed; UnicodeEncoding uEncoding = new UnicodeEncoding(); int byteCount = uEncoding.GetBytes(Chars, 0, 10, bytes, 0); bool expectedValue = true; bool actualValue = true; Encoder eC = uEncoding.GetEncoder(); eC.Convert(Chars, 0, 10, desBytes, 0, 20, true, out buffer, out outChars, out completed); if (completed) { for (int i = 0; i < 20; i++) { actualValue = actualValue & (bytes[i] == desBytes[i]); } } Assert.Equal(expectedValue, actualValue); }