private void InitializeManaged()

in src/cs/Microsoft.PhoneticMatching/Matchers/FuzzyMatcher/AbstractFuzzyMatcher.cs [269:301]


        private void InitializeManaged(IList<Target> targets, DistanceFunc distance, Func<Target, Extraction> targetToExtraction, Func<Extraction, Pronounceable> extractionToPronounceable)
        {
            this.targets = targets;
            this.distance = distance;
            this.targetToExtraction = targetToExtraction;
            this.extractionToPronounceable = extractionToPronounceable;
            this.nativeDistanceDelegate = this.Distance;

            if (targetToExtraction == null)
            {
                try
                {
                    this.extractions = (IList<Extraction>)targets;
                }
                catch
                {
                    throw new InvalidCastException(string.Format("Can't cast Target type [{0}] to Extraction type [{1}]. You must provide a conversion function 'targetToExtraction'.", typeof(Target), typeof(Extraction)));
                }
            }
            else
            {
                this.extractions = new Extraction[targets.Count];
            }

            if (extractionToPronounceable == null)
            {
                this.pronounceables = (IList<Pronounceable>)this.extractions;
            }
            else
            {
                this.pronounceables = new Pronounceable[targets.Count];
            }
        }