Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SuggestionEventArgs.cs
1using System;
2using System.Collections.Generic;
3
5{
9 public class SuggestionEventArgs : EventArgs
10 {
11 private readonly SortedDictionary<string, bool> suggestions;
12 private readonly string startsWith;
13
18 {
19 this.suggestions = new SortedDictionary<string, bool>(StringComparer.CurrentCultureIgnoreCase);
20 this.startsWith = StartsWith;
21 }
22
26 public string StartsWith => this.startsWith;
27
32 public void AddSuggestion(string Suggestion)
33 {
34 if (Suggestion.StartsWith(this.startsWith, StringComparison.InvariantCultureIgnoreCase) &&
35 !this.suggestions.ContainsKey(Suggestion))
36 {
37 this.suggestions[Suggestion] = true;
38 }
39 }
40
45 public string[] ToArray()
46 {
47 string[] Result = new string[this.suggestions.Count];
48 this.suggestions.Keys.CopyTo(Result, 0);
49 return Result;
50 }
51 }
52}
Event arguments for suggestion event handlers.
void AddSuggestion(string Suggestion)
Adds a suggestion.
string StartsWith
Only suggestions starting with this string will be returned.
SuggestionEventArgs(string StartsWith)
Event arguments for suggestion event handlers.
string[] ToArray()
Returns suggestions, as an array of strings.