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
Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the `head` section of `html` page.
7
17
@@ -33,7 +43,7 @@ If writing the result into a `<script>` element, be sure to use the `.ToHtmlEsca
33
43
34
44
## What is Schema.org?
35
45
36
-
[schema.org](https://schema.org) defines a set of standard classes and their properties for objects and services in the real world. This machinereadable format is a common standard used across the web for describing things.
46
+
[schema.org](https://schema.org) defines a set of standard classes and their properties for objects and services in the real world. This machine-readable format is a common standard used across the web for describing things.
37
47
38
48
## Where is Schema.org Used?
39
49
@@ -77,7 +87,7 @@ Windows UWP apps let you share data using schema.org classes. [Here](https://doc
77
87
78
88
schema.org defines classes and properties, where each property can have a single value or an array of multiple values. Additionally, properties can have multiple types e.g. an `Address` property could have a type of `string` or a type of `PostalAddress` which has it's own properties such as `StreetAddress` or `PostalCode` which breaks up an address into it's constituent parts.
79
89
80
-
To facilitate this Schema.NET uses some clever C# generics and implicit type conversions so that setting a single or multiple values is possible and that setting a `string` or `PostalAddress` is also possible:
90
+
To facilitate this SchemaDotNet uses some clever C# generics and implicit type conversions so that setting a single or multiple values is possible and that setting a `string` or `PostalAddress` is also possible:
81
91
82
92
```C#
83
93
// Single string address
@@ -89,11 +99,11 @@ var organization = new Organization()
89
99
// Multiple string addresses
90
100
varorganization=newOrganization()
91
101
{
92
-
Address=newList<string>()
93
-
{
102
+
Address=
103
+
[
94
104
"123 Old Kent Road E10 6RL",
95
105
"456 Finsbury Park Road SW1 2JS"
96
-
}
106
+
]
97
107
};
98
108
99
109
// Single PostalAddress address
@@ -109,8 +119,8 @@ var organization = new Organization()
109
119
// Multiple PostalAddress addresses
110
120
varorganization=newOrganization()
111
121
{
112
-
Address=newList<PostalAddress>()
113
-
{
122
+
Address=
123
+
[
114
124
newPostalAddress()
115
125
{
116
126
StreetAddress="123 Old Kent Road",
@@ -121,17 +131,17 @@ var organization = new Organization()
121
131
StreetAddress="456 Finsbury Park Road",
122
132
PostalCode="SW1 2JS"
123
133
}
124
-
}
134
+
]
125
135
};
126
136
127
137
// Mixed Author types
128
138
varbook=newBook()
129
139
{
130
-
Author=newList<object>()
131
-
{
140
+
Author=
141
+
[
132
142
newOrganization() { Name="Penguin" },
133
143
newPerson() { Name="J.D. Salinger" }
134
-
}
144
+
]
135
145
};
136
146
137
147
// Deconstruct a property containing mixed types
@@ -145,18 +155,11 @@ This magic is all carried out using [implicit conversion operators](https://docs
145
155
146
156
## More Examples
147
157
148
-
For more examples and actual running code samples, take a look at the unit tests in the project source code.
149
-
150
-
## Schema.NET.Pending
151
-
152
-
There are many pending types on [schema.org](https://schema.org) which are not yet fully formed and ready for production. If you need to use these, you can install the [Schema.NET.Pending](https://www.nuget.org/packages/SchemaDotNet.Pending) NuGet package instead of [Schema.NET](https://www.nuget.org/packages/SchemaDotNet). This package contains all released schema types as well as all pending types.
For more examples and actual running code samples, take a look at the [unit tests](https://github.com/TimmyMC/Schema.NET/tree/main/Tests/Schema.NET.Test/Examples) in the project source code.
There are many pending types on [schema.org](https://schema.org) which are not yet fully formed and ready for production. If you need to use these, you can install the [SchemaDotNet.Pending](https://www.nuget.org/packages/SchemaDotNet.Pending) NuGet package instead of [SchemaDotNet](https://www.nuget.org/packages/SchemaDotNet). This package contains all released schema types as well as all pending types.
0 commit comments