Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main() => new Program().Foo();
- bool someCondition;
- void Foo()
- {
- DoSomething<string>("abc", someMethod);
- DoSomething<string[]>("abc", someMethod);
- }
- public void DoSomething<T>(string someString, Func<T, bool> someMethod)
- {
- if (someCondition)
- {
- string A = null;
- bool resultA = method(A);
- }
- else
- {
- string[] B = null;
- bool resultB = method(B);
- }
- // Some other stuff here ...
- }
- bool someMethod(string simpleString) => true;
- bool someMethod(string[] stringArray) => true;
- private bool method(string[] b)
- {
- throw new NotImplementedException();
- }
- private bool method(string a)
- {
- throw new NotImplementedException();
- }
- }
Add Comment
Please, Sign In to add comment