Build a Model Context Protocol (MCP) Server in C# π§
Learn how to create an MCP server using .NET 8 and ASP.NET Core!β‘οΈ
This guide walks you through building a server that can interact with AI models via the Model Context Protocol β a standard for managing model prompts, memory, and tools. Great for AI agent developers!π€ π§
[ Blog ] : https://devblogs.microsoft.com/dotnet/build-a-model-context-protocol-mcp-server-in-csharp
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#AI #MCP #dotnet #csharp
@ProgrammingTip
Learn how to create an MCP server using .NET 8 and ASP.NET Core!
This guide walks you through building a server that can interact with AI models via the Model Context Protocol β a standard for managing model prompts, memory, and tools. Great for AI agent developers!
[ Blog ] : https://devblogs.microsoft.com/dotnet/build-a-model-context-protocol-mcp-server-in-csharp
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#AI #MCP #dotnet #csharp
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Microsoft News
Build a Model Context Protocol (MCP) server in C#
Learn how to build a Model Context Protocol (MCP) server using the C# SDK to enable seamless communication between AI models and applications.
C# 14 - Extension Members π
C# 14 adds new syntax to define extension members. The new syntax enables you to declare extension properties in addition to extension methods.βοΈ
You can also declare extension members that extend the type, rather than an instance of the type. In other words, these new extension members can appear as static members of the type you extend.
The following code example shows an example of the different kinds of extension members you can declare:
The members in the first extension block are called as though they're instance members of
[ Blog ] : https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#csharp #dotnet
@ProgrammingTip
C# 14 adds new syntax to define extension members. The new syntax enables you to declare extension properties in addition to extension methods.
You can also declare extension members that extend the type, rather than an instance of the type. In other words, these new extension members can appear as static members of the type you extend.
The following code example shows an example of the different kinds of extension members you can declare:
public static class Enumerable
{
// Extension block
extension<TSource>(IEnumerable<TSource> source) // extension members for IEnumerable<TSource>
{
// Extension property:
public bool IsEmpty => !source.Any();
// Extension indexer:
public TSource this[int index] => source.Skip(index).First();
// Extension method:
public IEnumerable<TSource> Where(Func<TSource, bool> predicate) { ... }
}
// extension block, with a receiver type only
extension<TSource>(IEnumerable<TSource>) // static extension members for IEnumerable<Source>
{
// static extension method:
public static IEnumerable<TSource> Combine(IEnumerable<TSource> first, IEnumerable<TSource> second) { ... }
// static extension property:
public static IEnumerable<TSource> Identity => yield return default;
}
}
The members in the first extension block are called as though they're instance members of
IEnumerable<TSource>, for example sequence.IsEmpty. The members in the second extension block are called as though they're static members of IEnumerable<TSource>, for example IEnumerable<int>.Identity.[ Blog ] : https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#csharp #dotnet
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Programming Tips Resources
The Hidden Cost of DateTime.Now in .NET π°
You're Using DateTime.Nowβββand It's Breaking Your Code β¦β
Let's be honest: We've all written this:
It works⦠until it doesn't.
In production, this little line can wreck your logic due to clock drift, time zone shifts, or mocking nightmares. π
[ Article ] : https://freedium.cfd/https://medium.com/@yaseer.arafat/the-hidden-cost-of-datetime-now-and-what-every-net-developer-should-use-instead-8859863257a1
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#dotnet #csharp
@ProgrammingTip
You're Using DateTime.Nowβββand It's Breaking Your Code β¦
Let's be honest: We've all written this:
if (DateTime.Now > token.Expiry)
{
return Unauthorized();
}
It works⦠until it doesn't.
In production, this little line can wreck your logic due to clock drift, time zone shifts, or mocking nightmares. π
[ Article ] : https://freedium.cfd/https://medium.com/@yaseer.arafat/the-hidden-cost-of-datetime-now-and-what-every-net-developer-should-use-instead-8859863257a1
γ°οΈγ°οΈγ°οΈγ°οΈγ°οΈγ°οΈ
#dotnet #csharp
@ProgrammingTip
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Programming Tips Resources