This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Class1 | |
| { | |
| private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
| public void MyMethod1() | |
| { | |
| // do something | |
| Log.Debug("Example log message"); | |
| Log.Warn("This is a warning."); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.ComponentModel; | |
| using System.ComponentModel.DataAnnotations; | |
| using System.Web.Mvc; | |
| namespace Website.Models.EntityFrameworkCodeFirst | |
| { | |
| public class Entry | |
| { | |
| [Key] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foreach (ModelState state in ViewData.ModelState.Values.Where(x => x.Errors.Count > 0)) | |
| { | |
| var setbreakpointhere = 1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MemoryStream mStream = | |
| new MemoryStream(ASCIIEncoding.Default.GetBytes("Your string here")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IEnumerable<int> ints; | |
| var random = new Random(); | |
| var shuffled = ints.OrderBy(i => random.Next()).ToList(); | |
| // or we can avoid risks of using OrderBy by declaring our own | |
| var random = new Random(); | |
| var shuffled = ints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // take specific amount from randomised collection of the children | |
| var children = CurrentModel.Children; | |
| var random = new Random(); | |
| var shuffled = children.OrderBy(i => random.Next()).ToList().Take(childCount); | |
| children = new DynamicNodeList(shuffled); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @using uComponents.DataTypes.MultiUrlPicker.Dto | |
| @using uComponents.DataTypes.UrlPicker | |
| @inherits umbraco.MacroEngines.DynamicNodeContext | |
| @{ | |
| const string propertyAlias = "propertyAlias"; | |
| MultiUrlPickerState links = null; | |
| string value = CurrentModel.GetPropertyValue(propertyAlias); | |
| if (!string.IsNullOrEmpty(value)) | |
| { | |
| links = MultiUrlPickerState.Deserialize(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string GetDaySuffix(int day) | |
| { | |
| switch (day) | |
| { | |
| case 1: | |
| case 21: | |
| case 31: | |
| return "st"; | |
| case 2: | |
| case 22: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @{ | |
| Layout = null; | |
| } | |
| @{ | |
| string url = string.Format("{0}://{1}{2}?nodeId={3}", Request.Url.Scheme, Request.Url.Authority, Url.GetUmbracoApiService<ProductsApiController>("GetProductById"), Model.Content.Id); | |
| } | |
| <a href="@url" target="_blank">@url</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private IEnumerable<string> GetRelativePathsToRoot(string virtualPath, string filter) | |
| { | |
| var physicalPath = Server.MapPath(virtualPath); | |
| var absolutePaths = Directory.EnumerateFiles( | |
| physicalPath, | |
| filter, | |
| SearchOption.AllDirectories | |
| ); | |
| return absolutePaths.Select( | |
| x => Url.Content(virtualPath + x.Replace(physicalPath, "")) |