This file contains 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 Resource : IDisposable | |
{ | |
private IntPtr nativeResource = Marshal.AllocHGlobal(100); | |
private AnotherResource managedResource = new AnotherResource(); | |
// Dispose() calls Dispose(true) | |
public void Dispose() | |
{ | |
Dispose(true); | |
GC.SuppressFinalize(this); |
This file contains 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
USE [InfoClient] | |
GO | |
/****** Object: StoredProcedure [dbo].[GenerateInserts] Script Date: 09/30/2011 11:32:13 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
ALTER PROC [dbo].[GenerateInserts] | |
( |
This file contains 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
/// <summary> | |
/// Returns an enumerator for the _Items class | |
/// </summary> | |
/// <returns>An enumerator for the _Items class</returns> | |
public IEnumerator GetEnumerator() | |
{ | |
return new ItemsEnumerator(this); | |
} | |
#endregion |
This file contains 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; | |
using System.ComponentModel; | |
using Csla; | |
using Csla.Core; | |
using ErrorEventArgs = Csla.Core.ErrorEventArgs; | |
namespace Business.Entities | |
{ | |
public delegate void ExceptionEventHandler(object sender, ErrorEventArgs args); |
This file contains 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
/// <summary> | |
/// Translates a "MyRule" object to a Sequence of If-Then-Assign-Actions | |
/// </summary> | |
public class DynamicSalutationRulesActivity : Activity | |
{ | |
public InArgument<Person> Person { get; set; } | |
public DynamicSalutationRulesActivity(List<SalutationAssignmentRule> rules) | |
{ | |
Common.AddVbSetting(this); |
This file contains 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
/// <summary> | |
/// Prints the collection as a comma separated string | |
/// </summary> | |
public static string ToStringList<T>(this ICollection<T> list) | |
{ | |
var sb = new StringBuilder(); | |
int i = 0; | |
foreach (var elem in list) | |
{ | |
sb.Append(elem.ToString()); |
This file contains 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
/// <summary> | |
/// Prints the collection as a comma separated string | |
/// </summary> | |
public static string ToStringList<T>(this IEnumerable<T> list) | |
{ | |
if (list == null) return String.Empty; | |
var sb = new StringBuilder(); | |
foreach (var elem in list) | |
{ |
This file contains 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 string PrettyPrint(string xml) | |
{ | |
XmlDocument doc = new XmlDocument(); | |
doc.LoadXml(xml); | |
var sb = new StringBuilder(); | |
var sw = new StringWriter(sb); | |
var xw = new XmlTextWriter(sw); | |
xw.Formatting = Formatting.Indented; | |
doc.WriteTo(xw); |
This file contains 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
On Error Resume Next | |
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") | |
Set listLocalUsers = objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount = True") | |
dim Text | |
For Each localUser in listLocalUsers | |
Text = Text & "Short Name: " & localuser.Name | |
Text = Text & ", Full Name: " & localUser.FullName | |
Text = Text & ", Description: " & localUser.Description | |
Text = Text & chr(13)& chr(10) |
This file contains 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
[TestClass] | |
public class SerializationTest | |
{ | |
[TestMethod] | |
public void TestSerialize() | |
{ | |
var serializer = new XmlSerializer(typeof(Entity)); | |
} |
OlderNewer