Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
92b0aaa0
Commit
92b0aaa0
authored
Aug 15, 2008
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a nullable int for the memoizedSize, just because it's neater.
parent
9deef9ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
AbstractMessage.cs
csharp/ProtocolBuffers/AbstractMessage.cs
+5
-7
No files found.
csharp/ProtocolBuffers/AbstractMessage.cs
View file @
92b0aaa0
...
@@ -26,12 +26,11 @@ namespace Google.ProtocolBuffers {
...
@@ -26,12 +26,11 @@ namespace Google.ProtocolBuffers {
public
abstract
class
AbstractMessage
<
TMessage
,
TBuilder
>
:
IMessage
<
TMessage
,
TBuilder
>
public
abstract
class
AbstractMessage
<
TMessage
,
TBuilder
>
:
IMessage
<
TMessage
,
TBuilder
>
where
TMessage
:
AbstractMessage
<
TMessage
,
TBuilder
>
where
TMessage
:
AbstractMessage
<
TMessage
,
TBuilder
>
where
TBuilder
:
AbstractBuilder
<
TMessage
,
TBuilder
>
{
where
TBuilder
:
AbstractBuilder
<
TMessage
,
TBuilder
>
{
// TODO(jonskeet): Cleaner to use a Nullable<int>?
/// <summary>
/// <summary>
/// The serialized size if it's already been computed, or
-1
/// The serialized size if it's already been computed, or
null
/// if we haven't computed it yet.
/// if we haven't computed it yet.
/// </summary>
/// </summary>
private
int
memoizedSize
=
-
1
;
private
int
?
memoizedSize
=
null
;
#
region
Unimplemented
members
of
IMessage
#
region
Unimplemented
members
of
IMessage
public
abstract
MessageDescriptor
DescriptorForType
{
get
;
}
public
abstract
MessageDescriptor
DescriptorForType
{
get
;
}
...
@@ -113,12 +112,11 @@ namespace Google.ProtocolBuffers {
...
@@ -113,12 +112,11 @@ namespace Google.ProtocolBuffers {
public
virtual
int
SerializedSize
{
public
virtual
int
SerializedSize
{
get
{
get
{
int
size
=
memoizedSize
;
if
(
memoizedSize
!=
null
)
{
if
(
size
!=
-
1
)
{
return
memoizedSize
.
Value
;
return
size
;
}
}
size
=
0
;
int
size
=
0
;
foreach
(
KeyValuePair
<
FieldDescriptor
,
object
>
entry
in
AllFields
)
{
foreach
(
KeyValuePair
<
FieldDescriptor
,
object
>
entry
in
AllFields
)
{
FieldDescriptor
field
=
entry
.
Key
;
FieldDescriptor
field
=
entry
.
Key
;
if
(
field
.
IsRepeated
)
{
if
(
field
.
IsRepeated
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment