本文整理汇总了C#中System.RuntimeType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeType.ToString方法的具体用法?C# RuntimeType.ToString怎么用?C# RuntimeType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.RuntimeType
的用法示例。
在下文中一共展示了RuntimeType.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultDisplayName
/// <summary>
/// Indicates whether the current framework is available on
/// this machine.
/// </summary>
//public bool IsAvailable
//{
// get { return IsAvailable(this); }
//}
private static string DefaultDisplayName(RuntimeType runtime, Version version)
{
return runtime.ToString() + " " + version.ToString();
}
示例2: GetDefaultDisplayName
private static string GetDefaultDisplayName(RuntimeType runtime, Version version)
{
if (version == DefaultVersion)
return runtime.ToString();
else if (runtime == RuntimeType.Any)
return "v" + version;
else
return runtime + " " + version;
}
示例3: Init
[System.Security.SecurityCritical] // auto-generated
internal void Init(Object o, Identity idObj, RuntimeType requestedType)
{
Message.DebugOut("RemotingServices::FillObjRef: IN");
BCLDebug.Assert(idObj != null,"idObj != null");
// Set the URI of the object to be marshaled
uri = idObj.URI;
// Figure out the type
MarshalByRefObject obj = idObj.TPOrObject;
BCLDebug.Assert(null != obj, "Identity not setup correctly");
// Get the type of the object
RuntimeType serverType = null;
if(!RemotingServices.IsTransparentProxy(obj))
{
serverType = (RuntimeType)obj.GetType();
}
else
{
serverType = (RuntimeType)RemotingServices.GetRealProxy(obj).GetProxiedType();
}
RuntimeType typeOfObj = (null == requestedType ? serverType : requestedType);
// Make sure that the server and requested types are compatible
// (except for objects that implement IMessageSink, since we
// just hand off the message instead of invoking the proxy)
if ((null != requestedType) &&
!requestedType.IsAssignableFrom(serverType) &&
(!typeof(IMessageSink).IsAssignableFrom(serverType)))
{
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString(
"Remoting_InvalidRequestedType"),
requestedType.ToString())); ;
}
#if FEATURE_COMINTEROP
// Create the type info
if(serverType.IsCOMObject)
{
// __ComObjects need dynamic TypeInfo
DynamicTypeInfo dt = new DynamicTypeInfo(typeOfObj);
TypeInfo = (IRemotingTypeInfo) dt;
}
else
#endif // FEATURE_COMINTEROP
{
RemotingTypeCachedData cache = (RemotingTypeCachedData)
InternalRemotingServices.GetReflectionCachedData(typeOfObj);
TypeInfo = (IRemotingTypeInfo)cache.TypeInfo;
}
if (!idObj.IsWellKnown())
{
// Create the envoy info
EnvoyInfo = System.Runtime.Remoting.EnvoyInfo.CreateEnvoyInfo(idObj as ServerIdentity);
// Create the channel info
IChannelInfo chan = (IChannelInfo)new ChannelInfo();
// Make sure the channelInfo only has x-appdomain data since the objref is agile while other
// channelData might not be and regardless this data is useless for an appdomain proxy
if (o is AppDomain){
Object[] channelData = chan.ChannelData;
int channelDataLength = channelData.Length;
Object[] newChannelData = new Object[channelDataLength];
// Clone the data so that we dont [....] the current appdomain data which is stored
// as a static
Array.Copy(channelData, newChannelData, channelDataLength);
for (int i = 0; i < channelDataLength; i++)
{
if (!(newChannelData[i] is CrossAppDomainData))
newChannelData[i] = null;
}
chan.ChannelData = newChannelData;
}
ChannelInfo = chan;
if (serverType.HasProxyAttribute)
{
SetHasProxyAttribute();
}
}
else
{
SetWellKnown();
}
// See if we should and can use a url obj ref?
if (ShouldUseUrlObjRef())
{
if (IsWellKnown())
{
// full uri already supplied.
SetObjRefLite();
}
//.........这里部分代码省略.........
示例4: Init
internal void Init(object o, Identity idObj, RuntimeType requestedType)
{
this.uri = idObj.URI;
MarshalByRefObject tPOrObject = idObj.TPOrObject;
RuntimeType c = null;
if (!RemotingServices.IsTransparentProxy(tPOrObject))
{
c = (RuntimeType) tPOrObject.GetType();
}
else
{
c = (RuntimeType) RemotingServices.GetRealProxy(tPOrObject).GetProxiedType();
}
RuntimeType typeOfObj = (null == requestedType) ? c : requestedType;
if (((null != requestedType) && !requestedType.IsAssignableFrom(c)) && !typeof(IMessageSink).IsAssignableFrom(c))
{
throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_InvalidRequestedType"), new object[] { requestedType.ToString() }));
}
if (c.IsCOMObject)
{
DynamicTypeInfo info = new DynamicTypeInfo(typeOfObj);
this.TypeInfo = info;
}
else
{
RemotingTypeCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(typeOfObj);
this.TypeInfo = reflectionCachedData.TypeInfo;
}
if (!idObj.IsWellKnown())
{
this.EnvoyInfo = System.Runtime.Remoting.EnvoyInfo.CreateEnvoyInfo(idObj as ServerIdentity);
IChannelInfo info2 = new System.Runtime.Remoting.ChannelInfo();
if (o is AppDomain)
{
object[] channelData = info2.ChannelData;
int length = channelData.Length;
object[] destinationArray = new object[length];
Array.Copy(channelData, destinationArray, length);
for (int i = 0; i < length; i++)
{
if (!(destinationArray[i] is CrossAppDomainData))
{
destinationArray[i] = null;
}
}
info2.ChannelData = destinationArray;
}
this.ChannelInfo = info2;
if (c.HasProxyAttribute)
{
this.SetHasProxyAttribute();
}
}
else
{
this.SetWellKnown();
}
if (ShouldUseUrlObjRef())
{
if (this.IsWellKnown())
{
this.SetObjRefLite();
}
else
{
string str = ChannelServices.FindFirstHttpUrlForObject(this.URI);
if (str != null)
{
this.URI = str;
this.SetObjRefLite();
}
}
}
}
示例5: GetDefaultDisplayName
private static string GetDefaultDisplayName(RuntimeType runtime, Version version, Profile profile)
{
string displayName;
if (version == DefaultVersion)
displayName = runtime.ToString();
else if (runtime == RuntimeType.Any)
displayName = "v" + version.ToString();
else
displayName = runtime.ToString() + " " + version.ToString();
if (profile != Profile.Unspecified && profile != Profile.Full)
displayName += " - " + profile.ToString();
return displayName;
}
示例6: CreateSymbolName
private string CreateSymbolName(RuntimeType symbol)
{
//if (symbol == null)
// throw new ArgumentNullException("symbol");
//if (symbol.IsGeneric)
// throw new NotImplementedException();
//StringBuilder sb = new StringBuilder();
//if (symbol.DeclaringType != null) {
// sb.Append(CreateSymbolName(symbol.DeclaringType));
// sb.Append('+');
//}
//else {
// if (!string.IsNullOrEmpty(symbol.Namespace)) {
// sb.Append(symbol.Namespace);
// sb.Append('.');
// }
//}
//sb.Append(symbol.Name);
//return sb.ToString();
string symbolName = symbol.ToString();
return symbolName;
}