public String255(char *str, int length) { if (length > MaximumLength) throw new ArgumentException(MsgStrMustBeLessThanMax); fixed(char *buffer = this.Buffer) { LibC.WMemCpy(buffer, str, length); buffer[length] = '\0'; } this.Length = (byte)length; }
public String255(String255 str, int startIndex, int length) { if (startIndex >= str.Length) { throw new ArgumentException("The start index is too large."); } if (length > str.Length - startIndex) { throw new ArgumentException("The length is too large."); } if (length > MaximumLength) throw new ArgumentException(MsgStrMustBeLessThanMax); fixed(char *buffer = this.Buffer) { LibC.WMemCpy(buffer, &str.Buffer[startIndex], length); buffer[length] = '\0'; } this.Length = (byte)length; }