SIL.FieldWorks.CacheLight.RealDataCache.get_Prop C# (CSharp) Method

get_Prop() public method

Member get_Prop
public get_Prop ( int hvo, int tag ) : object
hvo int hvo
tag int tag
return object
		public object get_Prop(int hvo, int tag)
		{
			CheckDisposed();

			object result = null;
			var fieldType = MetaDataCache.GetFieldType(tag);
			if (get_IsPropInCache(hvo, tag, fieldType, 0))
			{
				var key = new HvoFlidKey(hvo, tag);
				switch ((CellarPropertyType)fieldType)
				{
					case CellarPropertyType.Boolean:
						result = m_boolCache[key];
						break;
					case CellarPropertyType.Integer:
						result = m_intCache[key];
						break;
					case CellarPropertyType.Numeric:
						break; // m_intCache.ContainsKey(key);
					case CellarPropertyType.Float:
						break; // m_intCache.ContainsKey(key);
					case CellarPropertyType.Time:
						result = m_longCache[key];
						break;
					case CellarPropertyType.Guid:
						result = m_guidCache[key];
						break;
					case CellarPropertyType.Image:
						break; //  m_intCache.ContainsKey(key);
					case CellarPropertyType.GenDate:
						break; //  m_intCache.ContainsKey(key);
					case CellarPropertyType.Binary:
						break;
					case CellarPropertyType.String:
						result = m_basicITsStringCache[key];
						break;
					case CellarPropertyType.MultiUnicode:
					case CellarPropertyType.MultiString:
						result = get_MultiStringProp(hvo, tag);
						break;
					case CellarPropertyType.Unicode:
						result = m_basicStringCache[key];
						break;

					case CellarPropertyType.OwningAtomic: // Fall through
					case CellarPropertyType.ReferenceAtomic:
						return m_intCache[key];

					case CellarPropertyType.OwningCollection:
					case CellarPropertyType.ReferenceCollection:
					case CellarPropertyType.OwningSequence:
					case CellarPropertyType.ReferenceSequence:
						result = m_vectorCache[key];
						break;
				}
			}
			else
			{
				var ms = get_MultiStringProp(hvo, tag);
				if (ms.StringCount > 0)
					result = ms;
				else if (Marshal.IsComObject(ms))
					Marshal.ReleaseComObject(ms);
			}

			return result;
		}