示例#1
0
        bool IRemotingTypeInfo.CanCastTo(System.Type targetType, object o)
        {
            //      Console.WriteLine ("CanCastTo: " + targetType);

            // if this is a local servant, check it directly
            if (_realObject != null)
            {
                return(targetType.IsInstanceOfType(_realObject));
            }

            // check if the thing was created with a valid type
            if (targetType.IsInstanceOfType(o))
            {
                return(true);
            }

            // otherwise, perform the remote query if necessary
            string icename = IceUtil.TypeToIceName(targetType);

            if (_typeIds == null)
            {
                Ice.Object iob = o as Ice.Object;
                _typeIds = iob.ice_ids();
            }

            return(((IList)_typeIds).Contains(icename));
        }
示例#2
0
        public string[] ice_ids()
        {
            ArrayList typenames = new ArrayList();
            Type      t         = this.GetType();

            while (t != typeof(Ice.Object))
            {
                typenames.Add(IceUtil.TypeToIceName(t));
                t = t.BaseType;
            }
            typenames.Add("::Ice::Object"); // blah.


            return((string[])typenames.ToArray(typeof(string)));
        }
示例#3
0
 public string ice_id()
 {
     return(IceUtil.TypeToIceName(this.GetType()));
 }