@@ -131,18 +131,18 @@ public RecordingMethodImplementationGeneratorSwitchBodyCase(SwitchBodyRecord rec
131131 _cases = cases ;
132132 }
133133
134- public IMethodImplementationGeneratorSwitchBody < TArg1 , TReturnType > CompileTimeBody ( Func < TArg1 , TReturnType > func )
134+ public IMethodImplementationGeneratorSwitchBody < TArg1 , TReturnType > ReturnConstantValue ( Func < TArg1 , TReturnType > constantValueFactory )
135135 {
136136 foreach ( var caseValue in _cases )
137137 {
138- var result = func ( caseValue ) ;
138+ var result = constantValueFactory ( caseValue ) ;
139139 _record . CaseKeys . Add ( ( object ) caseValue ?? throw new InvalidOperationException ( "Switch case value cannot be null" ) ) ;
140140 _record . CaseValues . Add ( result ) ;
141141 }
142142 return new RecordingMethodImplementationGeneratorSwitchBody < TArg1 , TReturnType > ( _record ) ;
143143 }
144144
145- public IMethodImplementationGeneratorSwitchBody < TArg1 , TReturnType > RuntimeBody ( Func < TArg1 , Action < TReturnType > > func )
145+ public IMethodImplementationGeneratorSwitchBody < TArg1 , TReturnType > UseBody ( Func < TArg1 , Action < TReturnType > > body )
146146 {
147147 foreach ( var caseValue in _cases )
148148 {
@@ -169,7 +169,7 @@ public IMethodImplementationGenerator<TArg1, TReturnType> CompileTimeBody(Func<T
169169 return new RecordingMethodImplementationGenerator < TArg1 , TReturnType > ( _record ) ;
170170 }
171171
172- public IMethodImplementationGenerator < TArg1 , TReturnType > RuntimeBody ( Func < TArg1 , Func < TReturnType > > func )
172+ public IMethodImplementationGenerator < TArg1 , TReturnType > WithBody ( Func < TArg1 , Func < TReturnType > > func )
173173 {
174174 _record . HasDefaultCase = true ;
175175 return new RecordingMethodImplementationGenerator < TArg1 , TReturnType > ( _record ) ;
0 commit comments