Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
      • Overview
      • Function interface
      • YcFunction interface
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Developing in .NET Core
  2. Programming model
  3. Overview

C# programming model

Written by
Yandex Cloud
Updated at October 18, 2023

Cloud Functions provides two models for programming in C#: using the YcFunction interface and an independent class with a compatible method. Both models involve writing their own interface implementations and let you provide a function with one argument and one return value of any type.

The difference between these models lies in the presence of the invocation context. For example, if you need to interact with Yandex Cloud services using the SDK, we recommend choosing YcFunction.

Regardless of the selected model, a project is uploaded in one of the following ways: as a published csproj project or as a set of *cs files with source code. The second option is suitable for handlers that have no external dependencies. In addition, the following requirements apply to a class that contains a handler function:

  1. It must be public.
  2. It must have a public constructor with no arguments.
    By default, it is present. But if you created your own constructor that accepts arguments, you should also create a constructor that does not accept any arguments.
  3. It should not be generic.

Regardless of the selected model, the handler can be an async method that returns a Task or Task<T>. For the option with the independent class, the async void value can be returned.

In this case, there are two separate types: byte[] and String. Using them is slightly different from using other types. If you use them as the handler function argument type, the runtime will not convert an incoming request to a JSON interpretation for these types and will deliver it directly to the user handler function. The exception is when the parameter ?integration=raw.

Was the article helpful?

Previous
Overview
Next
Function interface
Yandex project
© 2025 Yandex.Cloud LLC