本文整理汇总了C#中ResourceManager.ReleaseAllResources方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceManager.ReleaseAllResources方法的具体用法?C# ResourceManager.ReleaseAllResources怎么用?C# ResourceManager.ReleaseAllResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.ReleaseAllResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Net20Comp
// a default, no parameter constructor is required
public Net20Comp()
{
System.Reflection.Assembly a = this.GetType().Assembly;
ResourceManager rm = new ResourceManager("net20comp", a);
byte[] data = (byte[])rm.GetObject("head");
head = Encoding.ASCII.GetString(data);
data = (byte[])rm.GetObject("body");
body = Encoding.ASCII.GetString(data);
rm.ReleaseAllResources();
}
示例2: runTest
public virtual bool runTest()
{
Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
ResourceWriter writer;
ThreadStart tdst1;
Thread[] thdPool;
Boolean fLoopExit;
try {
do
{
iCountTestcases++;
if(File.Exists(Environment.CurrentDirectory+"\\Co3878_A.resources"))
File.Delete(Environment.CurrentDirectory+"\\Co3878_A.resources");
writer = new ResourceWriter("Co3878_A.resources");
for(int i=0; i<iNumberOfStringsInFile; i++)
writer.AddResource("Key " + i, "Value " + i);
writer.Generate();
writer.Close();
iThreadsCompleted = 0;
thdPool = new Thread[iNumberOfThreads];
for(int i=0; i<iNumberOfThreads; i++){
tdst1 = new ThreadStart(this.RSMangerForEachThread);
thdPool[i] = new Thread(tdst1);
}
for(int i=0; i<iNumberOfThreads; i++){
thdPool[i].Start();
}
do {
int numberAlive = 0;
fLoopExit = false;
Thread.Sleep(100);
for(int i=0; i<iNumberOfThreads; i++){
if(thdPool[i].IsAlive) {
fLoopExit = true;
numberAlive ++;
}
}
}while(fLoopExit);
if(iThreadsCompleted != iNumberOfThreads){
iCountErrors++;
Console.WriteLine("Err_67423csd! All the thrads didn't execute the function. Expected, " + iNumberOfThreads + " completed, " + iThreadsCompleted);
}
iCountTestcases++;
if(File.Exists(Environment.CurrentDirectory+"\\Co3878_B.resources"))
File.Delete(Environment.CurrentDirectory+"\\Co3878_B.resources");
writer = new ResourceWriter("Co3878_B.resources");
for(int i=0; i<iNumberOfStringsInFile; i++)
writer.AddResource("Key " + i, "Value " + i);
writer.Generate();
writer.Close();
manager = ResourceManager.CreateFileBasedResourceManager("Co3878_B", Environment.CurrentDirectory, null);
iThreadsCompleted = 0;
thdPool = new Thread[iNumberOfThreads];
for(int i=0; i<iNumberOfThreads; i++){
tdst1 = new ThreadStart(this.RSMangerForAllThreads);
thdPool[i] = new Thread(tdst1);
}
for(int i=0; i<iNumberOfThreads; i++){
thdPool[i].Start();
}
do {
fLoopExit = false;
Thread.Sleep(100);
for(int i=0; i<iNumberOfThreads; i++){
if(thdPool[i].IsAlive)
fLoopExit = true;
}
}while(fLoopExit);
if(iThreadsCompleted != iNumberOfThreads){
iCountErrors++;
Console.WriteLine("Err_7539cd! All the threads didn't execute the function. Expected, " + iNumberOfThreads + " completed, " + iThreadsCompleted);
}
manager.ReleaseAllResources();
} while (false);
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general);
}
if ( iCountErrors == 0 )
{
Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
return true;
}
else
{
Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}