How to change a multi line text field to allow unlimited length in a document library

There is a restriction on number of characters (255 characters) allowed for a Multi line text field added to a document library when you try to input more than 255 characters through UI.

Attaching a sample code which will help in working around the problem of restriction on number of characters (255 characters) allowed for a Multi line text field added to a document library.

SPSite mySite = new SPSite("<https://SiteURL>");

SPWeb myWeb = mySite.OpenWeb();

SPList myList = myWeb.Lists["<DOCLIBNAME>"];

SPField myField = myList.Fields["MULTILINE-FIELDNAME"];

((SPFieldMultiLineText)myField).UnlimitedLengthInDocumentLibrary = true;

myField.Update();