Fan.Sys.FanObj.isImmutable C# (CSharp) Method

isImmutable() public method

public isImmutable ( ) : bool
return bool
        public virtual bool isImmutable()
        {
            return @typeof().isConst();
        }

Same methods

FanObj::isImmutable ( object self ) : bool

Usage Example

Example #1
0
        /**
         * Make a thread-safe copy of the specified object.
         * If it is immutable, then just return it; otherwise
         * we make a serialized copy.
         */
        public static object safe(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            if (FanObj.isImmutable(obj))
            {
                return(obj);
            }
            Buf buf = new MemBuf(512);

            buf.writeObj(obj);
            buf.flip();
            return(buf.readObj());
        }