A summary of the official Microsoft C# coding conventions, based on Microsoft’s documentation.
- PascalCase for class, property, method, and namespace names
public class MyExampleClass { }
| package templating | |
| import ( | |
| "encoding/base64" | |
| "net/http" | |
| "time" | |
| "reload-helper/internal/global" | |
| ) |
| func loadEnvVars(filename string) { | |
| file, err := os.Open(filename) | |
| if err != nil { | |
| log.Fatalf("failed to open env file: %v", err) | |
| } | |
| defer file.Close() | |
| scanner := bufio.NewScanner(file) | |
| for scanner.Scan() { | |
| line := strings.TrimSpace(scanner.Text()) |
A summary of the official Microsoft C# coding conventions, based on Microsoft’s documentation.
public class MyExampleClass { }| @page "/" | |
| @using System.Security.Claims | |
| @inject AuthenticationStateProvider AuthenticationStateProvider | |
| <PageTitle>Home</PageTitle> | |
| <h1>Hello, world!</h1> | |
| Welcome to your new app. | |
| <h3>ClaimsPrincipal Data</h3> |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "net/url" | |
| "strings" | |
| ) |
Please observe the difference in speed when calling resp.Body.Close().
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "strconv" | |
| ) | |
| var ( | |
| paragraphs = []string{ |
| using Org.BouncyCastle.Crypto; | |
| using Org.BouncyCastle.Crypto.Encodings; | |
| using Org.BouncyCastle.Crypto.Engines; | |
| using Org.BouncyCastle.Crypto.Generators; | |
| using Org.BouncyCastle.OpenSsl; | |
| using Org.BouncyCastle.Security; | |
| using System.Text; | |
| namespace RSATest |
| func Addslashes(str string) string { | |
| var buf bytes.Buffer | |
| for _, char := range str { | |
| switch char { | |
| case `'`, `"`, `\`: | |
| buf.WriteRune(`\`) | |
| } | |
| buf.WriteRune(char) | |
| } | |
| return buf.String() |