Reputation: 37
hi i am using the following code from msdn for internal use for my company:
using System;
public sealed class Singleton
{
private static volatile Singleton instance;
private static object syncRoot = new Object();
private Singleton() {}
public static Singleton Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new Singleton();
}
}
return instance;
}
}
}
i wonder if this is illegal or i have to get any permission or license from Microsoft in order to use that. it is just a singleton pattern.the other one is page object pattern that is use for automation that i search online
Upvotes: 2
Views: 965
Reputation: 11
STW's answer is probably out-of-date. As of today, the link provided now lands here: https://learn.microsoft.com/en-us/legal/mdsa?redirectedfrom=MSDN, Microsoft Developer Agreement. Part of which says,
Software and Microsoft Content
Using Microsoft Software and Microsoft Content outside the Service. Microsoft may provide you with Microsoft Software or Microsoft Content through or as a part of the Services. Termination or suspension of this Agreement or of your use or access to the Services terminates your right to possess or use any such Microsoft Software or Microsoft Content unless separately licensed to you. The suspension or termination of a User Plan terminates that user’s right to possess or use any such Microsoft Software or Microsoft Content associated with, or contingent upon that User Plan. You must delete all copies of such Microsoft Software or Microsoft Content licensed under this Agreement and destroy any associated media upon the termination of the associated possession or usage rights. This subsection does not apply to Microsoft Software addressed in subsection (b) below.
Software and Content on Documentation Portals. Third-party software and Content accessible on the Documentation Portals is made available by the designated publisher under the associated license terms.
Scope of rights. All Microsoft Software and Microsoft Content are the copyrighted works of Microsoft or its suppliers are licensed not sold and may not be transferred unless specified otherwise.
So, it's not as clear cut as STW claims. Maybe the Microsoft Limited Public License still exists and still applies to code samples in Microsoft's documentation website, but it's not at that link.
Upvotes: 1
Reputation: 46396
Yes, you can use MSDN sample code without permission, as it's available under the Microsoft Limited Public License:
This license governs use of code marked as “sample” or “example" available on this web site without a license agreement, as provided under the section above titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use such code (the “software”), you accept this license. If you do not accept the license, do not use the software.
...
- Grant of Rights
(A) Copyright Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
Upvotes: 4