Пример #1
0
        /// <summary>
        ///     Verify that evidence being stored in this descriptor is of the correct type
        /// </summary>
        private bool CheckEvidenceType(EvidenceBase evidence)
        {
            Contract.Assert(evidence != null);

            ILegacyEvidenceAdapter legacyAdapter = evidence as ILegacyEvidenceAdapter;
            Type storedType = legacyAdapter == null?evidence.GetType() : legacyAdapter.EvidenceType;

            return(m_evidenceType == null || m_evidenceType.IsAssignableFrom(storedType));
        }
        private static object UnwrapEvidence(EvidenceBase evidence)
        {
            ILegacyEvidenceAdapter adapter = evidence as ILegacyEvidenceAdapter;

            if (adapter != null)
            {
                return(adapter.EvidenceObject);
            }
            return(evidence);
        }
        private static Type GetEvidenceIndexType(EvidenceBase evidence)
        {
            ILegacyEvidenceAdapter adapter = evidence as ILegacyEvidenceAdapter;

            if (adapter != null)
            {
                return(adapter.EvidenceType);
            }
            return(evidence.GetType());
        }