public static SerializedObject Serialize(string strName, ICustomSerializer objCustomSerializer) { if ((strName == null) || (strName.Length == 0)) { throw new ArgumentOutOfRangeException("strName", "A valid non-null, non-empty string is required.."); } if (objCustomSerializer == null) { throw new ArgumentException("objCustomSerializer", "A valid non-null ICustomSerializer is required.."); } SerializedTypeInfo objTypeInfo = new SerializedTypeInfo(objCustomSerializer); SerializedObject objSerializedObject = new SerializedObject(strName, objTypeInfo); objCustomSerializer.WriteData(objSerializedObject); return(objSerializedObject); }