FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ClearScript/ClearScript/HostList.cs at master · bubdm/ClearScript · GitHub
bubdm
/
ClearScript
Public
forked from
ClearFoundry/ClearScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
ClearScript
/
ClearScript
/
HostList.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (59 loc) · 1.83 KB
Breadcrumbs
ClearScript
/
ClearScript
/
HostList.cs
Copy path
File metadata and controls
75 lines (59 loc) · 1.83 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using
System
;
using
System
.
Collections
;
using
System
.
Collections
.
Generic
;
using
Microsoft
.
ClearScript
.
Util
;
namespace
Microsoft
.
ClearScript
{
internal
interface
IHostList
{
int
Count
{
get
;
}
object
this
[
int
index
]
{
get
;
set
;
}
}
internal
sealed
class
HostList
:
IHostList
{
private
readonly
ScriptEngine
engine
;
private
readonly
IList
list
;
private
readonly
Type
elementType
;
public
HostList
(
ScriptEngine
engine
,
IList
list
,
Type
elementType
)
{
this
.
engine
=
engine
;
this
.
list
=
list
;
this
.
elementType
=
elementType
;
}
#region IHostList implementation
public
int
Count
=>
list
.
Count
;
public
object
this
[
int
index
]
{
get
=>
engine
.
PrepareResult
(
list
[
index
]
,
elementType
,
ScriptMemberFlags
.
None
,
true
)
;
set
=>
list
[
index
]
=
value
;
}
#endregion
}
internal
sealed
class
HostList
<
T
>
:
IHostList
{
private
readonly
ScriptEngine
engine
;
private
readonly
IList
<
T
>
list
;
public
HostList
(
ScriptEngine
engine
,
IList
<
T
>
list
)
{
this
.
engine
=
engine
;
this
.
list
=
list
;
}
#region IHostList implementation
public
int
Count
=>
list
.
Count
;
public
object
this
[
int
index
]
{
get
=>
engine
.
PrepareResult
(
list
[
index
]
,
ScriptMemberFlags
.
None
,
true
)
;
set
{
if
(
!
typeof
(
T
)
.
IsAssignableFrom
(
ref
value
)
)
{
throw
new
InvalidOperationException
(
"Assignment invalid due to type mismatch"
)
;
}
list
[
index
]
=
(
T
)
value
;
}
}
#endregion
}
}
Back
|
FazBrowse Home
|
New Git URL