diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc
index b139c06014bec833600da14d19e44921acc2aaec..82dd06bcec4c39cca7d84b081b4dc5d44bdfe0dc 100644
--- a/src/compiler/csharp_generator.cc
+++ b/src/compiler/csharp_generator.cc
@@ -36,6 +36,7 @@
 #include <vector>
 
 #include "src/compiler/config.h"
+#include "src/compiler/csharp_generator_helpers.h"
 #include "src/compiler/csharp_generator.h"
 
 using grpc::protobuf::FileDescriptor;
@@ -44,35 +45,18 @@ using grpc::protobuf::ServiceDescriptor;
 using grpc::protobuf::MethodDescriptor;
 using grpc::protobuf::io::Printer;
 using grpc::protobuf::io::StringOutputStream;
+using grpc_generator::MethodType;
+using grpc_generator::GetMethodType;
+using grpc_generator::METHODTYPE_NO_STREAMING;
+using grpc_generator::METHODTYPE_CLIENT_STREAMING;
+using grpc_generator::METHODTYPE_SERVER_STREAMING;
+using grpc_generator::METHODTYPE_BIDI_STREAMING;
 using std::map;
 using std::vector;
 
 namespace grpc_csharp_generator {
 namespace {
 
-enum MethodType {
-  METHODTYPE_NO_STREAMING,
-  METHODTYPE_CLIENT_STREAMING,
-  METHODTYPE_SERVER_STREAMING,
-  METHODTYPE_BIDI_STREAMING
-};
-
-MethodType GetMethodType(const MethodDescriptor *method) {
-  if (method->client_streaming()) {
-    if (method->server_streaming()) {
-      return METHODTYPE_BIDI_STREAMING;
-    } else {
-      return METHODTYPE_CLIENT_STREAMING;
-    }
-  } else {
-    if (method->server_streaming()) {
-      return METHODTYPE_SERVER_STREAMING;
-    } else {
-      return METHODTYPE_NO_STREAMING;
-    }
-  }
-}
-
 std::string GetCSharpNamespace(const FileDescriptor* file) {
   // TODO(jtattermusch): this should be based on csharp_namespace option
   return file->package();
diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h
index 374e1374cf4c4a12de9fdabe1f28759d4bf2a671..7ce4ec526c98865a76a84afd4346ce2c6b0c616b 100644
--- a/src/compiler/generator_helpers.h
+++ b/src/compiler/generator_helpers.h
@@ -116,6 +116,29 @@ inline grpc::string FileNameInUpperCamel(const grpc::protobuf::FileDescriptor *f
   return LowerUnderscoreToUpperCamel(StripProto(file->name()));
 }
 
+enum MethodType {
+  METHODTYPE_NO_STREAMING,
+  METHODTYPE_CLIENT_STREAMING,
+  METHODTYPE_SERVER_STREAMING,
+  METHODTYPE_BIDI_STREAMING
+};
+
+inline MethodType GetMethodType(const grpc::protobuf::MethodDescriptor *method) {
+  if (method->client_streaming()) {
+    if (method->server_streaming()) {
+      return METHODTYPE_BIDI_STREAMING;
+    } else {
+      return METHODTYPE_CLIENT_STREAMING;
+    }
+  } else {
+    if (method->server_streaming()) {
+      return METHODTYPE_SERVER_STREAMING;
+    } else {
+      return METHODTYPE_NO_STREAMING;
+    }
+  }
+}
+
 }  // namespace grpc_generator
 
 #endif  // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H