I\'m using Linq To XML
new XElement(\"Prefix\", Prefix == null ? \"\" : Prefix)
but I want to do some computation to the prefix before addi
C# 7 adds support for local functions
Here is the previous example using a local function
void Method() { string localFunction(string source) { // add your functionality here return source ; }; // call the inline function localFunction("prefix"); }