Convert Figma logo to code with AI

dotnet logocorefx

This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime

17,679
4,945
17,679
0

Top Related Projects

14,331

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.

11,073

Mono open source ECMA CLI, C# and .NET implementation.

14,915

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

20,851

.NET news, announcements, release notes, and more!

18,892

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.

Quick Overview

The dotnet/corefx repository is the former home of .NET Core foundational libraries. It contained the core framework libraries for .NET, including System.Collections, System.IO, System.Xml, and many others. However, this repository is now archived and its contents have been moved to the dotnet/runtime repository as part of the .NET 5+ unification effort.

Pros

  • Provided a comprehensive set of core libraries for .NET development
  • Open-source, allowing community contributions and transparency
  • Cross-platform support, enabling development for Windows, macOS, and Linux
  • High performance and optimized implementations of fundamental .NET types and APIs

Cons

  • Repository is now archived, potentially leading to confusion for newcomers
  • Migration to dotnet/runtime may cause temporary disruption for contributors
  • Historical issues and pull requests may be harder to track after the move
  • Some older documentation and external references may still point to this repository

Code Examples

As this repository is archived and its contents have been moved, it's more appropriate to provide examples from the current dotnet/runtime repository. Here are a few examples of core .NET functionality:

  1. Using LINQ to filter and project a collection:
using System;
using System.Linq;

var numbers = new[] { 1, 2, 3, 4, 5 };
var evenSquares = numbers.Where(n => n % 2 == 0).Select(n => n * n);
Console.WriteLine(string.Join(", ", evenSquares)); // Output: 4, 16
  1. Working with async/await for file operations:
using System;
using System.IO;
using System.Threading.Tasks;

async Task WriteFileAsync(string path, string content)
{
    await File.WriteAllTextAsync(path, content);
    Console.WriteLine($"File written: {path}");
}

await WriteFileAsync("example.txt", "Hello, World!");
  1. Using the HttpClient to make a web request:
using System;
using System.Net.Http;
using System.Threading.Tasks;

async Task<string> FetchWebPageAsync(string url)
{
    using var client = new HttpClient();
    return await client.GetStringAsync(url);
}

var content = await FetchWebPageAsync("https://example.com");
Console.WriteLine(content.Substring(0, 100)); // Print first 100 characters

Getting Started

To start using the core .NET libraries in your project:

  1. Ensure you have the latest .NET SDK installed from https://dotnet.microsoft.com/download
  2. Create a new console application:
    dotnet new console -n MyApp
    cd MyApp
    
  3. Edit the Program.cs file to use core libraries
  4. Run your application:
    dotnet run
    

For more advanced usage and API documentation, refer to the official .NET documentation at https://docs.microsoft.com/en-us/dotnet/

Competitor Comparisons

14,331

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.

Pros of dotnet

  • More comprehensive and up-to-date documentation
  • Broader scope, covering the entire .NET ecosystem
  • Active community engagement and frequent updates

Cons of dotnet

  • Larger repository size, potentially slower to clone and navigate
  • More complex structure due to its broader scope
  • Steeper learning curve for newcomers to the .NET ecosystem

Code Comparison

corefx:

public static string GetResourceString(string key)
{
    return SR.GetResourceString(key, null);
}

dotnet:

public static string GetResourceString(string key, string? culture = null)
{
    return SR.GetResourceString(key, culture);
}

The dotnet repository's version of this method includes an optional culture parameter, allowing for more flexible localization support.

Both repositories contain essential components of the .NET framework, but dotnet offers a more comprehensive view of the entire ecosystem. While corefx focuses specifically on the core framework libraries, dotnet encompasses a broader range of .NET-related projects and documentation.

Developers looking for a deep dive into core framework internals might find corefx more focused, while those seeking a holistic understanding of the .NET ecosystem would benefit from exploring dotnet. The choice between the two depends on the specific needs and interests of the developer or project at hand.

11,073

Mono open source ECMA CLI, C# and .NET implementation.

Pros of mono

  • Longer history and more mature codebase
  • Broader platform support, including mobile and game engines
  • More flexible licensing (MIT/X11)

Cons of mono

  • Slower development pace compared to CoreFX
  • Less focus on cloud-native and modern application patterns
  • Smaller active contributor base

Code Comparison

mono:

public class Socket : IDisposable
{
    private SafeSocketHandle m_Handle;
    public Socket (AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
    {
        // Implementation
    }
}

CoreFX:

public partial class Socket : IDisposable
{
    private SafeSocketHandle _handle;
    public Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
    {
        // Implementation
    }
}

The code structures are similar, with minor differences in naming conventions and implementation details. Both repositories implement the Socket class with similar method signatures and use SafeSocketHandle for managing the underlying socket resource.

CoreFX tends to have more extensive documentation and inline comments, while mono's codebase may have more platform-specific conditionals due to its broader support for different environments.

14,915

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

Pros of runtime

  • Unified repository for .NET Core runtime, libraries, and SDK
  • Improved build and test infrastructure
  • More streamlined development process for contributors

Cons of runtime

  • Larger repository size, potentially slower cloning and initial setup
  • Steeper learning curve for new contributors due to increased complexity
  • Potential for merge conflicts in high-activity areas

Code comparison

runtime:

public static class Console
{
    public static TextWriter Out => OutWriter;
    public static TextWriter Error => ErrorWriter;
    public static TextReader In => InReader;
}

corefx:

public static class Console
{
    public static TextWriter Out { get; }
    public static TextWriter Error { get; }
    public static TextReader In { get; }
}

The code comparison shows a subtle difference in property implementation between the two repositories. runtime uses expression-bodied members, while corefx uses auto-implemented properties. This reflects the ongoing evolution and modernization of the codebase in runtime.

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

Pros of aspnetcore

  • More focused on web development, providing specialized frameworks and libraries
  • Includes built-in dependency injection and middleware pipeline
  • Offers better integration with modern front-end technologies

Cons of aspnetcore

  • Larger learning curve for developers new to ASP.NET ecosystem
  • More opinionated architecture, which may limit flexibility in some scenarios
  • Heavier resource footprint compared to corefx

Code Comparison

aspnetcore:

app.UseRouting();
app.UseEndpoints(endpoints =>
{
    endpoints.MapGet("/", async context =>
    {
        await context.Response.WriteAsync("Hello World!");
    });
});

corefx:

HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8080/");
listener.Start();
HttpListenerContext context = listener.GetContext();
context.Response.Close();

The aspnetcore example demonstrates the use of middleware and routing, while the corefx example shows a more low-level approach to handling HTTP requests. aspnetcore provides a higher level of abstraction and more built-in functionality for web development, whereas corefx offers more flexibility but requires more manual setup for web-specific tasks.

20,851

.NET news, announcements, release notes, and more!

Pros of core

  • More comprehensive, covering the entire .NET Core ecosystem
  • Better organized with clearer documentation and roadmap
  • More active development and community engagement

Cons of core

  • Larger and potentially more complex for newcomers
  • May include components not needed for specific use cases
  • Slower to navigate due to broader scope

Code comparison

corefx:

public static class Console
{
    public static void WriteLine(string value)
    {
        // Implementation
    }
}

core:

namespace System
{
    public static class Console
    {
        public static void WriteLine(string value)
        {
            // Implementation
        }
    }
}

The code structure in core is more complete, including namespace declarations and potentially more extensive implementations.

18,892

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.

Pros of Roslyn

  • Focuses on compiler and language services, providing deeper insights into C# and VB.NET
  • Offers powerful APIs for code analysis, refactoring, and generation
  • Enables creation of custom analyzers and code fixes

Cons of Roslyn

  • Narrower scope compared to CoreFX's broad .NET functionality
  • Steeper learning curve for developers not familiar with compiler internals
  • May require more frequent updates to keep pace with language evolution

Code Comparison

Roslyn (syntax tree manipulation):

var tree = CSharpSyntaxTree.ParseText("class C { }");
var root = tree.GetRoot();
var newRoot = root.ReplaceNode(
    root.DescendantNodes().OfType<ClassDeclarationSyntax>().First(),
    SyntaxFactory.ClassDeclaration("NewClass")
);

CoreFX (file system operations):

using System.IO;

string path = @"C:\example.txt";
File.WriteAllText(path, "Hello, World!");
string content = File.ReadAllText(path);

This comparison highlights the different focus areas of Roslyn and CoreFX. Roslyn excels in language-specific tasks, while CoreFX provides a wide range of .NET functionality for various application needs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Going forward, the .NET team is using https://github.com/dotnet/runtime to develop the code and issues formerly in this repository.

Please see the following for more context:

dotnet/announcements#119 "Consolidating .NET GitHub repos"