-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Reinstate supplemental API remarks (System.Runtime) #12699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gewarren
merged 6 commits into
dotnet:main
from
gewarren:reinstate-remarks-system-runtime
Jun 4, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a8435c8
moved add'l remarks back to this repo
gewarren 95d8eec
fix snippets 5000 errors
gewarren 9556e66
fix compile errors
gewarren 4bb99dd
fix compile errors
gewarren a600453
fix errors
gewarren ca2630d
Apply suggestions from code review
gewarren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...ystem.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/Friend2.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...rp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/friend2.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // <Snippet6> | ||
| using System; | ||
|
|
||
| public class Example1 | ||
| { | ||
| public static void Main() | ||
| { | ||
| String s = "The Sign of the Four"; | ||
| //Console.WriteLine(Utilities.StringUtilities.StringLib.IsFirstLetterUpperCase(s)); | ||
| } | ||
| } | ||
| // </Snippet6> | ||
|
gewarren marked this conversation as resolved.
|
||
23 changes: 23 additions & 0 deletions
23
.../System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/multiple1.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
|
|
||
| // <Snippet3> | ||
| [assembly:InternalsVisibleTo("Friend1a")] | ||
| [assembly:InternalsVisibleTo("Friend1b")] | ||
| // </Snippet3> | ||
|
|
||
| public class StringUtilities | ||
| { | ||
| internal string ToTitleCase(string value) | ||
| { | ||
| string retval = null; | ||
| for (int ctr = 0; ctr < value.Length; ctr++) | ||
| if (ctr == 0) | ||
| retval += Char.ToUpper(value[ctr]); | ||
| else if (ctr > 0 && Char.IsWhiteSpace(value[ctr - 1])) | ||
| retval += Char.ToUpper(value[ctr]); | ||
| else | ||
| retval += value[ctr]; | ||
| return retval; | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
.../System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/multiple2.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
|
|
||
| // <Snippet4> | ||
| [assembly:InternalsVisibleTo("Friend2a"), | ||
| InternalsVisibleTo("Friend2b")] | ||
| // </Snippet4> | ||
|
|
||
| namespace Utilities | ||
| { | ||
| public class StringUtilities1 | ||
| { | ||
| internal static string ToTitleCase(string value) | ||
| { | ||
| string retval = null; | ||
| for (int ctr = 0; ctr < value.Length; ctr++) | ||
| if (ctr == 0) | ||
| retval += Char.ToUpper(value[ctr]); | ||
| else if (ctr > 0 && Char.IsWhiteSpace(value[ctr - 1])) | ||
| retval += Char.ToUpper(value[ctr]); | ||
| else | ||
| retval += value[ctr]; | ||
| return retval; | ||
| } | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
...untime.CompilerServices/InternalsVisibleToAttribute/Overview/UtilityLib/UtilityLib.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
File renamed without changes.
13 changes: 0 additions & 13 deletions
13
...ts/csharp/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend2.cs
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
snippets/csharp/System.Runtime.CompilerServices/RuntimeHelpers/GetHashCode/gethashcodeex1.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // <Snippet1> | ||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
|
|
||
| public class Example | ||
| { | ||
| public static void Main() | ||
| { | ||
| Console.WriteLine("{0,-18} {1,6} {2,18:N0} {3,6} {4,18:N0}\n", | ||
| "", "Var 1", "Hash Code", "Var 2", "Hash Code"); | ||
|
|
||
| // Get hash codes of two different strings. | ||
| String sc1 = "String #1"; | ||
| String sc2 = "String #2"; | ||
| ShowHashCodes("sc1", sc1, "sc2", sc2); | ||
|
|
||
| // Get hash codes of two identical non-interned strings. | ||
| String s1 = "This string"; | ||
| String s2 = String.Format("{0} {1}", "This", "string"); | ||
| ShowHashCodes("s1", s1, "s2", s2); | ||
|
|
||
| // Get hash codes of two (evidently concatenated) strings. | ||
| String si1 = "This is a string!"; | ||
| String si2 = "This " + "is " + "a " + "string!"; | ||
| ShowHashCodes("si1", si1, "si2", si2); | ||
| } | ||
|
|
||
| private static void ShowHashCodes(String var1, Object value1, | ||
| String var2, Object value2) | ||
| { | ||
| Console.WriteLine("{0,-18} {1,6} {2,18:X8} {3,6} {4,18:X8}", | ||
| "Obj.GetHashCode", var1, value1.GetHashCode(), | ||
| var2, value2.GetHashCode()); | ||
|
|
||
| Console.WriteLine("{0,-18} {1,6} {2,18:X8} {3,6} {4,18:X8}\n", | ||
| "RTH.GetHashCode", var1, RuntimeHelpers.GetHashCode(value1), | ||
| var2, RuntimeHelpers.GetHashCode(value2)); | ||
| } | ||
| } | ||
| // The example displays output similar to the following: | ||
| // Var 1 Hash Code Var 2 Hash Code | ||
| // | ||
| // Obj.GetHashCode sc1 94EABD27 sc2 94EABD24 | ||
| // RTH.GetHashCode sc1 02BF8098 sc2 00BB8560 | ||
| // | ||
| // Obj.GetHashCode s1 29C5A397 s2 29C5A397 | ||
| // RTH.GetHashCode s1 0297B065 s2 03553390 | ||
| // | ||
| // Obj.GetHashCode si1 941BCEA5 si2 941BCEA5 | ||
| // RTH.GetHashCode si1 01FED012 si2 01FED012 | ||
| // </Snippet1> |
8 changes: 8 additions & 0 deletions
8
snippets/csharp/System.Runtime.InteropServices/ICustomMarshaler/Overview/Project.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
65 changes: 65 additions & 0 deletions
65
snippets/csharp/System.Runtime.InteropServices/ICustomMarshaler/Overview/source.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| using System; | ||
| // <Snippet4> | ||
| using System.Runtime.InteropServices; | ||
| // </Snippet4> | ||
|
|
||
| // <Snippet1> | ||
| public interface INew | ||
| { | ||
| void NewMethod(); | ||
| } | ||
| // </Snippet1> | ||
|
|
||
| // <Snippet2> | ||
| public interface ICustomMarshaler | ||
| { | ||
| Object MarshalNativeToManaged(IntPtr pNativeData); | ||
| IntPtr MarshalManagedToNative(Object ManagedObj); | ||
| void CleanUpNativeData(IntPtr pNativeData); | ||
| void CleanUpManagedData(Object ManagedObj); | ||
| int GetNativeDataSize(); | ||
| } | ||
| // </Snippet2> | ||
|
|
||
| namespace scope1 | ||
| { | ||
| // <Snippet3> | ||
| interface IUserData | ||
| { | ||
| void DoSomeStuff(INew pINew); | ||
| } | ||
| // </Snippet3> | ||
| } | ||
|
|
||
| namespace scope2 | ||
| { | ||
| // <Snippet5> | ||
| interface IUserData | ||
| { | ||
| void DoSomeStuff( | ||
| [MarshalAs(UnmanagedType.CustomMarshaler, | ||
| MarshalType="NewOldMarshaler")] | ||
| INew pINew | ||
| ); | ||
| } | ||
| // </Snippet5> | ||
| } | ||
|
|
||
| // <Snippet6> | ||
| public class NewOldMarshaler : ICustomMarshaler | ||
| { | ||
| public static ICustomMarshaler GetInstance(string pstrCookie) | ||
| => new NewOldMarshaler(); | ||
|
|
||
| public Object MarshalNativeToManaged(IntPtr pNativeData) => throw new NotImplementedException(); | ||
| public IntPtr MarshalManagedToNative(Object ManagedObj) => throw new NotImplementedException(); | ||
| public void CleanUpNativeData(IntPtr pNativeData) => throw new NotImplementedException(); | ||
| public void CleanUpManagedData(Object ManagedObj) => throw new NotImplementedException(); | ||
| public int GetNativeDataSize() => throw new NotImplementedException(); | ||
| } | ||
| // </Snippet6> | ||
|
|
||
| class StubClass | ||
| { | ||
| public static void Main() { } | ||
| } |
8 changes: 8 additions & 0 deletions
8
...ystem.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/Friend2.vbproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ic/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/friend2.vb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ' Visual Basic .NET Document | ||
| Option Strict On | ||
|
|
||
| ' <Snippet6> | ||
| Module Example1 | ||
| Public Sub Main() | ||
| Dim s As String = "The Sign of the Four" | ||
| ' Console.WriteLine(Utilities.StringUtilities.StringLib.IsFirstLetterUpperCase(s)) | ||
| End Sub | ||
|
gewarren marked this conversation as resolved.
|
||
| End Module | ||
| ' </Snippet6> | ||
21 changes: 21 additions & 0 deletions
21
.../System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/multiple1.vb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Imports System.Runtime.CompilerServices | ||
|
|
||
| ' <Snippet3> | ||
| <assembly:InternalsVisibleTo("Friend1a")> | ||
| <assembly:InternalsVisibleTo("Friend1b")> | ||
| ' </Snippet3> | ||
| Public Class StringUtilities | ||
| Friend Function ToTitleCase(value As String) As String | ||
| Dim retval As String = Nothing | ||
| For ctr As Integer = 0 To value.Length - 1 | ||
| If ctr = 0 Then | ||
| retval += Char.ToUpper(value(ctr)) | ||
| ElseIf ctr > 0 AndAlso Char.IsWhiteSpace(value(ctr - 1)) | ||
| retval += Char.ToUpper(value(ctr)) | ||
| Else | ||
| retval += value(ctr) | ||
| End If | ||
| Next | ||
| Return retval | ||
| End Function | ||
| End Class |
23 changes: 23 additions & 0 deletions
23
.../System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/Friend/multiple2.vb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Imports System.Runtime.CompilerServices | ||
|
|
||
| ' <Snippet4> | ||
| <Assembly:InternalsVisibleTo("Friend2a"), _ | ||
| Assembly:InternalsVisibleTo("Friend2b")> | ||
| ' </Snippet4> | ||
| Namespace Utilities | ||
| Public Class StringUtilities1 | ||
| Friend Shared Function ToTitleCase(value As String) As String | ||
| Dim retval As String = Nothing | ||
| For ctr As Integer = 0 To value.Length - 1 | ||
| If ctr = 0 Then | ||
| retval += Char.ToUpper(value(ctr)) | ||
| ElseIf ctr > 0 AndAlso Char.IsWhiteSpace(value(ctr - 1)) Then | ||
| retval += Char.ToUpper(value(ctr)) | ||
| Else | ||
| retval += value(ctr) | ||
| End If | ||
| Next | ||
| Return retval | ||
| End Function | ||
| End Class | ||
| End Namespace |
File renamed without changes.
13 changes: 0 additions & 13 deletions
13
...sualbasic/System.Runtime.CompilerServices/InternalsVisibleToAttribute/Overview/friend2.vb
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ets/visualbasic/System.Runtime.CompilerServices/RuntimeHelpers/GetHashCode/Project.vbproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Library</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.