Skip to content

Instantly share code, notes, and snippets.

@blubbll
Last active August 2, 2018 16:26
Show Gist options
  • Save blubbll/24368ad97252e84a46258b87d9ceed64 to your computer and use it in GitHub Desktop.
Save blubbll/24368ad97252e84a46258b87d9ceed64 to your computer and use it in GitHub Desktop.
c# get methods
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
var Methoden_raw = typeof(Program.keksKlasse).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static)
.Where(m => m.IsPublic);
List<String>Methoden = new List<String>();
foreach (var methode in Methoden_raw) {
var m = (methode.ToString()).Split(new string[] {" "},StringSplitOptions.None)[1]
.Split('(')[0]
.Trim();
Methoden.Add(m);
} Methoden.RemoveRange(Methoden.Count-4, 4);
foreach (var methode in Methoden) {
Console.WriteLine(methode);
}
}
class keksKlasse{
public static void doKeks(){
}
}
public static void logMe(string item){
Console.WriteLine(item);
}
public static string getString(){
return "test";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment