示例#1
0
 /// <summary>
 /// Creates a getter on the column. The getter returns the element at
 /// cursor.Position.
 /// </summary>
 public ValueGetter <DType2> GetGetter <DType2>(RowCursor cursor)
 {
     if (typeof(DType2) == typeof(ReadOnlyMemory <char>))
     {
         var res = GetGetterReadOnlyMemory(cursor) as ValueGetter <DType2>;
         if (res != null)
         {
             return(res);
         }
         throw new DataTypeError($"Unable to get a getter for type {typeof(DType2)} from type {typeof(DType)}.");
     }
     else
     {
         var _data2 = _data as DType2[];
         if (_data2 == null)
         {
             throw new NotSupportedException(string.Format("Unable to convert into {0}", typeof(DType2)));
         }
         var missing = DataFrameMissingValue.GetMissingOrDefaultValue(Kind);
         return((ref DType2 value) =>
         {
             value = cursor.Position < (long)Length
                     ? _data2[cursor.Position]
                     : (DType2)missing;
         });
     }
 }
 private ValueGetter<ReadOnlyMemory<char>> GetGetterReadOnlyMemory(IRowCursor cursor)
 {
     var _data2 = _data as DvText[];
     if (_data2 == null)
         throw new NotSupportedException(string.Format("Unable to convert into DvText"));
     var missing = DataFrameMissingValue.GetMissingOrDefaultValue(Kind);
     return (ref ReadOnlyMemory<char> value) =>
     {
         value = cursor.Position < (long)Length
                 ? _data2[cursor.Position].str
                 : null;
     };
 }