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
sbc.Subscribe(subs => | |
{ | |
Type type = GetRuntimeType(); // e.g. reflecting IHandle type... | |
//get pointer to generic method of specific type parameter | |
var methodInfo = subs.GetType().GetMethod("Handler", BindingFlags.Instance | BindingFlags.Public); | |
methodInfo = methodInfo.MakeGenericMethod(type); | |
// set up an action compatible with our method |
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
private T HandleItemCacheRetrieval<T>(string cacheKey, object cacheLock, Func<T> nonCachedMethod) | |
{ | |
T retVal = default(T); | |
try | |
{ | |
retVal = (T) Get(cacheKey); | |
} | |
catch (InvalidCastException ex) //it didn’t parse properly | |
{ | |
LoggerManager.Error(ex); |
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
var client = new ServiceReference1.Service1Client(); | |
var retried = 0; | |
bool succeeded = false; | |
while (!succeeded) | |
{ | |
if(retried > 42) throw new InvalidOperationException("Math is too hard."); | |
try | |
{ | |
var result = client.GetData(42); | |
succeeded = true; |
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
var task = Task.Factory.FromAsync(networkStream.BeginWrite, | |
networkStream.EndWrite, | |
data, 0, data.Length, | |
networkStream); | |
Task<Task<int>> task2 = task.ContinueWith(_ => Task<int>.Factory.FromAsync( | |
networkStream.BeginRead, | |
networkStream.EndRead, | |
incomingData, 0, | |
incomingData.Length, | |
networkStream)); |
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
NetworkStream networkStream = tcpClient.GetStream(); | |
networkStream.BeginWrite(data, 0, data.Length, | |
OnWriteCompleted, networkStream); | |
private static void OnWriteCompleted(IAsyncResult ar) | |
{ | |
NetworkStream myNetworkStream = | |
(NetworkStream)ar.AsyncState; | |
myNetworkStream.EndWrite(ar); |
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
networkStream.BeginWrite(data, 0, data.Length, | |
ar => | |
{ | |
NetworkStream myNetworkStream = | |
(NetworkStream) ar.AsyncState; | |
myNetworkStream.EndWrite(ar); | |
}, networkStream); |
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
Task.Factory.StartNew(() => Console.Write("started working...")) | |
.ContinueWith(_ => Console.WriteLine("doing something else...")) | |
.ContinueWith(_ => Console.WriteLine("done!")); |
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
error CS0583: Internal Compiler Error (0xc0000005 at address 000007F6B95A94B2): | |
likely culprit is 'TRANSFORM'. | |
An internal error has occurred in the compiler. To work around this | |
problem, try simplifying or changing the program near the locations | |
listed below. Locations at the top of the list are closer to the point | |
at which the internal error occurred. Errors such as this can be | |
reported to Microsoft by using the /errorreport option. | |
snippet.txt(7,27): error CS0584: Internal Compiler Error: stage 'TRANSFORM' |
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
The referenced assembly "X" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. |
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
Attempted re-targeting of the project has been canceled. To be able to target your test project to .NET Framework 3.5, you must use the steps documented at the following Microsoft Web site: http://go.microsoft.com/fwlink/?LinkId=201405. |
OlderNewer