You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Scripting with `dotnet run` (.NET 10 file-based apps)
317
+
318
+
### Accessing Internal Members
319
+
320
+
NumSharp has many key types/fields/methods marked `internal` (Shape.dimensions, Shape.strides, NDArray.Storage, np._FindCommonType, etc.). To access them from a `dotnet run` script, override the assembly name to match an existing `InternalsVisibleTo` entry:
321
+
322
+
```csharp
323
+
#:projectpath/to/src/NumSharp.Core
324
+
#:propertyAssemblyName=NumSharp.DotNetRunScript
325
+
#:propertyPublishAot=false
326
+
```
327
+
328
+
**How it works:** NumSharp declares `[assembly: InternalsVisibleTo("NumSharp.DotNetRunScript")]` in `src/NumSharp.Core/Assembly/Properties.cs`. The `#:property AssemblyName=NumSharp.DotNetRunScript` directive overrides the script's assembly name (which normally derives from the filename) to match, granting full access to all `internal` and `protected internal` members.
329
+
330
+
### Script Template (copy-paste ready)
331
+
332
+
```csharp
333
+
#:projectpath/to/src/NumSharp.Core
334
+
#:propertyAssemblyName=NumSharp.DotNetRunScript
335
+
#:propertyPublishAot=false
336
+
337
+
```
338
+
339
+
### Quick One-Liners
340
+
341
+
```bash
342
+
# Run a script with full internal access
343
+
dotnet run my_script.cs
344
+
345
+
# Compare NumPy vs NumSharp type promotion
346
+
dotnet run script.cs # where script.cs contains:
347
+
# var ct = np._FindCommonType(np.array(1), np.array(1.5));
0 commit comments