Bumblebee.CallStack.GetFirstNonBumblebeeMethod C# (CSharp) Method

GetFirstNonBumblebeeMethod() private method

private GetFirstNonBumblebeeMethod ( ) : MethodBase
return System.Reflection.MethodBase
		public static MethodBase GetFirstNonBumblebeeMethod()
		{
			var trace = new StackTrace(false);

			var frames = trace.GetFrames();

			if (frames == null)
			{
				throw new Exception("Unable to get the StackFrames from the StackTrace.");
			}

			var method = frames
				.Select(x => x.GetMethod())
				.First(x => (x.DeclaringType != null)
					&& (x.DeclaringType.Assembly != typeof (CallStack).Assembly)
					&& (Attribute.IsDefined(x.DeclaringType, typeof (BumblebeeAttribute)) == false)
					&& (Attribute.IsDefined(x, typeof (CompilerGeneratedAttribute)) == false)
					&& (Attribute.IsDefined(x.DeclaringType, typeof (CompilerGeneratedAttribute)) == false));

			return method;
		}
	}