FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/runtime/PythonTypes/PyIterable.cs at v3.1.0 · pythonnet/pythonnet · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
pythonnet
/
pythonnet
Public
Notifications
You must be signed in to change notification settings
Fork
780
Star
5.5k
Code
Issues
153
Pull requests
12
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
src
/
runtime
/
PythonTypes
/
PyIterable.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (36 loc) · 1.45 KB
Breadcrumbs
pythonnet
/
src
/
runtime
/
PythonTypes
/
PyIterable.cs
Copy path
File metadata and controls
40 lines (36 loc) · 1.45 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using
System
;
using
System
.
Collections
;
using
System
.
Collections
.
Generic
;
using
System
.
Runtime
.
Serialization
;
namespace
Python
.
Runtime
{
[
Serializable
]
public
class
PyIterable
:
PyObject
,
IEnumerable
<
PyObject
>
{
internal
PyIterable
(
BorrowedReference
reference
)
:
base
(
reference
)
{
}
internal
PyIterable
(
in
StolenReference
reference
)
:
base
(
reference
)
{
}
protected
PyIterable
(
SerializationInfo
info
,
StreamingContext
context
)
:
base
(
info
,
context
)
{
}
/// <summary>
/// Creates new instance from an existing object.
/// </summary>
/// <remarks>This constructor does not check if <paramref name="o"/> is actually iterable.</remarks>
public
PyIterable
(
PyObject
o
)
:
base
(
FromObject
(
o
)
)
{
}
static
BorrowedReference
FromObject
(
PyObject
o
)
{
if
(
o
is
null
)
throw
new
ArgumentNullException
(
nameof
(
o
)
)
;
return
o
.
Reference
;
}
/// <summary>
/// Return a new PyIter object for the object. This allows any iterable
/// python object to be iterated over in C#. A PythonException will be
/// raised if the object is not iterable.
/// </summary>
public
PyIter
GetEnumerator
(
)
{
return
PyIter
.
GetIter
(
this
)
;
}
IEnumerator
<
PyObject
>
IEnumerable
<
PyObject
>
.
GetEnumerator
(
)
=>
this
.
GetEnumerator
(
)
;
IEnumerator
IEnumerable
.
GetEnumerator
(
)
=>
this
.
GetEnumerator
(
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL