open System.Collections.Generic
{new System.IDisposable with
type CodeTypeDeclaration with
x.StartDirectives.Add(CodeRegionDirective(CodeRegionMode.Start,name)) |> ignore
x.EndDirectives.Add(CodeRegionDirective(CodeRegionMode.End,name)) |> ignore
member x.Regionize name =
onDisposal (fun _ -> x.Start(name)) (fun _ -> x.End(name))
member x.AddFields (kvpList:IDictionary<_,string>) f (cleaner:(string->string) option) =
for KeyValue(k,v) in kvpList do
let field = CodeMemberField(typedefof<string>,if cleaner.IsSome then cleaner.Value(v) else v)
x.Members.Add field |> ignore