FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/runtime/BorrowedReference.cs at drop-python2 · filmor/pythonnet · GitHub
filmor
/
pythonnet
Public
forked from
pythonnet/pythonnet
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
src
/
runtime
/
BorrowedReference.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (23 loc) · 817 Bytes
Breadcrumbs
pythonnet
/
src
/
runtime
/
BorrowedReference.cs
Copy path
File metadata and controls
25 lines (23 loc) · 817 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace
Python
.
Runtime
{
using
System
;
/// <summary>
/// Represents a reference to a Python object, that is being lent, and
/// can only be safely used until execution returns to the caller.
/// </summary>
readonly
ref
struct
BorrowedReference
{
readonly
IntPtr
pointer
;
public
bool
IsNull
=>
this
.
pointer
==
IntPtr
.
Zero
;
/// <summary>Gets a raw pointer to the Python object</summary>
public
IntPtr
DangerousGetAddress
(
)
=>
this
.
IsNull
?
throw
new
NullReferenceException
(
)
:
this
.
pointer
;
/// <summary>
/// Creates new instance of <see cref="BorrowedReference"/> from raw pointer. Unsafe.
/// </summary>
public
BorrowedReference
(
IntPtr
pointer
)
{
this
.
pointer
=
pointer
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL