static int Main(string[] args) { // workaround TypeConverterAttribute not being annotated correctly // https://github.com/dotnet/runtime/issues/39125 var _ = new MyStringConverter(); TypeDescriptor.AddAttributes(typeof(string), new TypeConverterAttribute(typeof(MyStringConverter))); var attribute = new DefaultValueAttribute(typeof(string), "Hello, world!"); return((string)attribute.Value == "Hello, world!trivia" ? 100 : -1); }
public ConsoleBotE(string message) { contentsForInsolent = new List <IContentAnswer <string> >(3) { new DoYouHaveCatOnKeyboard(), new WhatAreYouSleeping(), new FindDifferences(message) }; numberForIntelligent = randomForAnswer.Next(0, contentsForIntelligent.Count); numberForInsolent = randomForAnswer.Next(0, contentsForInsolent.Count); numberForPoser = randomForAnswer.Next(0, contentsForPoser.Count); stringConverter = new MyStringConverter(message); bot[0] = new AnswerOfInsolent(contentsForInsolent[numberForInsolent]); bot[1] = new AnswerOfIntelligent(contentsForIntelligent[numberForIntelligent]); bot[2] = new AnswerOfPoser(contentsForPoser[numberForPoser]); }