我需要将one.xaml文件的内容复制到字节clob中。这是我的代码。它看起来像我没有访问此文件的内容。谁能告诉我为什么。我是C#API的新手,但我是一名程序员。 4000的选择是因为最大的字符串大小限制,以防万一有人想知道。我可能会有关于zies等的bug。但主要的是我想将tham xaml文件的内容放入clob中。谢谢。只需将xaml文件复制到clob中即可。为什么不工作
string LoadedFileName = @"C:\temp2\one.xaml";//Fd.FileName;
byte[] clobByteTotal ;
FileStream stream = new FileStream(LoadedFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
if (stream.Length % 2 >= 1)
{
clobByteTotal = new byte[stream.Length + 1];
}
else clobByteTotal = new byte[stream.Length];
for (int i = 0; i <= stream.Length/4000; i++)
{
int x = (stream.Length/4000 == 0) ? (int)stream.Length : 4000;
stream.Read(stringSizeClob, i*4000, x);
String tempString1 = stringSizeClob.ToString();
byte[] clobByteSection = Encoding.Unicode.GetBytes(stringSizeClob.ToString());
Buffer.BlockCopy(clobByteSection, 0, clobByteTotal, i * clobByteSection.Length, clobByteSection.Length);
}
有**没有4000个字符的最大字符串大小限制**。你可能指的是字符串*文字长度的限制:一个完全不同的问题。 – Adam
感谢您的澄清和我的C#启发。 – user1298925