Continued “Is there an equivalent of C#'s nameof(..) in F#?”
问题 With reference to Is there an equivalent of C#'s nameof(..) in F#? how can the nameof function used or extended for the following case? let nameof (q:Expr<_>) = match q with | Patterns.Let(_, _, DerivedPatterns.Lambdas(_, Patterns.Call(_, mi, _))) -> mi.Name | Patterns.PropertyGet(_, mi, _) -> mi.Name | DerivedPatterns.Lambdas(_, Patterns.Call(_, mi, _)) -> mi.Name | _ -> failwith "Unexpected format" let any<'R> : 'R = failwith "!" let s = _nameof <@ System.Char.IsControl @> //OK type A<'a>()